Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I would like to color code the background of the dimension values in a straight table, somewhat like the "strip every" function but for every new value. With the following example table;
Dimension1 | Dimension2 | Expression |
---|---|---|
A | 1 | |
A | 2 | |
A | 3 | |
B | 1 | |
B | 2 | |
C | 1 | |
D | 1 | |
D | 2 | |
D | 3 | |
D | 4 |
I would like the background color of Dimension1 to be grey for the values A, white for B, grey for C, white for D and so on.
Is this possible? I have tried with the above() function but that doesn't seems to do the trick. The values of Dimension1 in the real data is not as simple as A-Z.
I don't want unique color for every value
It works with no selection, but if you for example select Dim2 = A,C then all rows are grey. I don't think it can be solved in the script.
I've tried it but sadly it doesn't work. Will try more with the aggr(), match() and concat() function though...
I defined the coulr for each value ofDim1 in the Script. So you selected any thing, automatically selection made.
Hi blaise, please try this: 1. open the table property window 2. select the dimension tab 3. click the plus (+) sign on the left of the dimension to fill with different colour 4. double click on background colour 5. enter your conditional fill expression [eg. =if(Dimension1 like 'A*',QlikTechBlue(),if(Dimension1 like 'B*',QlikTechGray(),Green())) ] 6. confirm changes Regards Andrea
doesn't solve my problem. I don't want to hard code colors to each dimensions.
is it possible for you to store the color (RGB combination) as part of your table? If YES, then in your table itself you can define which color you want for each dimension value (A, B, C etc..).
Then you can use the RGB values in your table object to define the color of the cell based on cell value.
Hi Blaise,
My last proposition is working weel i think, see attachement.
3 remarks :
- Don't forget the "=" sign before the variable expression
- if you have "set analysis" in the expressions of your table that could reduce the values of Dim2, use the same SET in the concat function of the variable
- The sort order of Dim2 must be fixed. If it's not sorted alphabeticaly, you can also define a custom sort order in the concat function
Good luck,
Thomas
Yes indeed, it works!
I would rather not have a variable that is calculated for every selection, but it might be that this is the only available solution .
Thanks for all your help
Hi blaise, try putting the following expression in the color property of the dimension: =if(Mod(FieldIndex('Dimension1',Dimension1),2)=1,QlikTechGray(),White()) Regards AL