Creating a Filter Button in GridJS - gridjs

I am new to gridjs and am struggling to find a way to add filter buttons. I am looking to add dropdown selectors or buttons that will filter out entire rows if a specified value is not in a specified column.
For example, if I have this table:
| Color | Another header |
| -------- | -------------- |
| Blue | Value1 |
| Green | Value2 |
| Blue | Value3
Is it possible within gridjs to create a filter dropdown that if you select blue, it would filter out all non-blue values and vice versa if you selected green?

Related

Choose custom column name in SELECT expression depending on returning data, PostgreSQL

Let say we have such table:
id | bird | color
1 | raven | black
2 | gull | white
3 | broadbill | green
4 | goldfinch | yellow
5 | tit | yellow
Is it possible in PostgreSQL to write such SELECT expression, which can make dynamic alias for the color column? This aliase's name should depend on selected data from the color column. It is assumed, that only one row is returned (i.e., LIMIT 1 is applied at the end).
Pseudocode:
SELECT id, bird, color
as 'bw' if color.value in ['black', 'white']
else
as 'colored'
FROM table
WHERE color = 'white'
LIMIT 1
Returning examples:
-- WHERE color = 'white'
id | bird | bw
1 | gull | white
-- WHERE color = 'yellow'
id | bird | colored
4 | goldfinch | yellow

How to derive a column based on two different merged dimensions in SAP Business Objects?

I have two tables, and I want to derive one column from Table1 to Table2 by common fields Name and Color (by merging).
But until I was using only one merged dimension and it was working well for me.
Now, for two dimensions, it is not working.
If I have two tables :
Table1 Name : Fruits
|--------|--------|---------------|
| Name | Color | Rateperunit |
|--------|--------|---------------|
| banana | yellow | 3 |
|--------|--------|---------------|
| apple | red | 25 |
|--------|--------|---------------|
| apple | green | 30 |
|--------|--------|---------------|
Table2 Name : Purchase
|--------|---------|-------------|-----------|----------|
| Item | Color | Rateperunit | Noofitems | Totalbill|
|--------|---------|-------------|-----------|----------|
| apple | green |30 | 3 | 90 |
|--------|---------|-------------|-----------|----------|

Cross tab with a list of values instead of summation

I want a Cross tab that lists field values and counts them instead of just giving a count for the summation. I know I could make this with groups but I cant list the values vertically that way. From my research I believe I have to use a Display String Formula.
SQL Field Data
-------------------------------------------------
| Play # | Formation |Back Set | R/P | PLAY |
-------------------------------------------------
| 1 | TREY | FG | R | TRUCK |
-------------------------------------------------
| 2 | T | FG | R | RHINO |
-------------------------------------------------
| 3 | D | FG | P | 5 STEP |
-------------------------------------------------
| 4 | D | FG | P | 5 STEP |
-------------------------------------------------
| 5 | K JET | NG | R | DOG |
-------------------------------------------------
Desired report structure:
-----------------------------------------------------------
| Backet & Formation | Run | Pass |
-----------------------------------------------------------
| NG K JET | BULLA 1 | |
| | HELL 3 | |
-----------------------------------------------------------
| FG D | | 5 STEP 2 |
-----------------------------------------------------------
| NG K JET | DOG | |
-----------------------------------------------------------
| FG T | RHINO | |
-----------------------------------------------------------
Don't see why a Crosstab is necessary for this - especially if the entire body of the report is just that table.
Group your records by Bracket and Formation - If that's not
something natively configured in your table, make a new Formula field
and group on that.
Drop the 3 relevant fields into whichever section you need to display. (It might be a Footer, based on whether or not you want repeats
Write a formula to determine whether or not Run or Pass are displayed, and place it in their suppression field. (Good luck getting a Crosstab to do that for you! It tends to prefer 0s over blanks.)
If there's more to the report than just this table, you can cheat the system by placing your "table" into a subreport. And of course you can stretch Line objects across the sections and it will stretch to form the table outlines

Combine multiple rows of the same column into one row

I have following data from my database:
+------+-----------+-------------+---------------+
| ID | SomeValue | SomeDate | SomeOtherDate |
+------+-----------+-------------+---------------+
| 123 | 12345 | 01.01.2017 | 01.01.2018 |
| 123 | 54321 | 01.01.2017 | 01.01.2019 |
| 123 | 25314 | 01.01.2017 | 01.01.2020 |
+------+-----------+-------------+---------------+
I want the following format in Crystal Reports:
+------+---------------+---------------+---------------+
| ID | SomeValue2018 | SomeValue2019 | SomeValue2020 |
+------+---------------+---------------+---------------+
| 123 | 12345 | 54321 | 25314 |
+------+---------------+---------------+---------------+
How can I do this, if it's even possible? I've tried multiple examples but cant seem to make it work. I was successfully able to make the headings.
It is difficult to make Crystal Reports evaluate things horizontally. The entire system is designed to evaluate vertically. (Things on the top of a report are evaluated before things below them.)
However you might be able to get a CrossTab to do this. First you'd want to make a new Forumla field for your columns. It would be structured something like:
"SomeValue" + Year({#SomeOtherDate})
When you design the crosstab, you'll want to set ID as the Row, your new formula from above as the Column, and the Summarized Field will be SomeValue. You'll also want to suppress the Grand Totals in the Customize Style.

Tableau - Show multiple discrete string (dropdown) dimensions side-by-side in a single table

I have a list of survey results that looks similar to the following:
| Email | Question 1 | Question 2 |
| ----------------- | ---------- | ---------- |
| test#example.com | Always | Sometimes |
| test2#example.com | Always | Always |
| test3#example.com | Sometimes | Never |
Question 1 and Question 2 (and a few others) have the same discrete set of values (from a dropdown list on the survey).
I want to show the data in the following format in Tableau (a table is fine, but a heatmap or highlight table would be best):
| | Always | Sometimes | Never |
| ---------- | ------ | --------- | ----- |
| Question 1 | 2 | 1 | 0 |
| Question 2 | 1 | 1 | 1 |
How can I achieve this? I've tried various combinations of rows and columns and I just can't seem to get close to this layout. Do I need to use a calculated value?
As far as I know - it is not natively possible with Tableau, because what you have is kind of a pivot table.
What you can do is unpivot the whole table as explained here https://stackoverflow.com/a/20543651/5130012, then you can load the data into Tableau and create the table you want.
I did some dummy data and tried it.
That's my "unpivoted" table:
Row,Column,Value
test,q1,always
test,q2,sometimes
test1,q1,sometimes
test1,q2,never
test10,q1,always
test10,q2,always
test11,q1,sometimes
test11,q2,never
And that's how it looks in Tableau: