Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to change the background colour in rows of a QS straight table when the main sort dimension value changes - something like this:
It doesn't really matter what colour it changes to, I just want to make it easier to read/separate the different order groups. I'm guessing this will involve using 'peek' ?? Thanks.
Below solution works, but you must be sure that MapPalette contains at least the same number of different colors per each distinct SalesID
MapPalette:
Mapping
Load * Inline [
RecID;RgbColor
1;RGB(0,0,0)
2;RGB(255,255,255)
3;RGB(255,0,0)
4;RGB(0,255,0)
5;RGB(0,0,255)
6;RGB(255,255,0)
7;RGB(0,255,255)
8;RGB(255,0,255)
9;RGB(192,192,192)
10;RGB(128,128,128)
11;RGB(128,0,0)
12;RGB(128,128,0)
13;RGB(0,128,0)
14;RGB(128,0,128)
15;RGB(0,128,128)
16;RGB(0,0,128)
] (delimiter is ';' ) ;
Data_TMP:
NoConcatenate
load * inline [
SalesID,SalesLine,Qty
S1000,1,25
S1000,2,6
S1000,5,12
S1005,3,27
S1005,4,16
S1008,1,4
S1008,2,21
S1008,3,47
];
DistinctSalesID:
NoConcatenate
Load Distinct
SalesID
Resident Data_TMP;
MapColor:
Mapping
Load
SalesID,
ApplyMap('MapPalette',RecNo()) as [RGB Color]
Resident DistinctSalesID;
Drop Table DistinctSalesID;
Final:
Load *,
ApplyMap('MapColor',SalesID) as [RGB Color]
Resident Data_TMP;
Drop Table Data_TMP;
You can achieve that by specifying a background color expression in all Dimensions and Measuers of your chart:
if(SalesID='S1000',rgb(255, 230, 153),
if(SalesID='S1005',rgb(180, 198, 231),
if(SalesID='S1008',rgb(198, 224, 180))))
Thanks for the suggestion @micheledenardi . However, the salesID is changing all the time, so I'm not able to hard-code it in that manner. When a salesID changes from the one on the previous row, it needs to trigger a change in the background colour of all rows using the new salesID. This could happen 20+ times in the table. The colour it changes to could be random, but preferably not too close to the previous colour. ..
Below solution works, but you must be sure that MapPalette contains at least the same number of different colors per each distinct SalesID
MapPalette:
Mapping
Load * Inline [
RecID;RgbColor
1;RGB(0,0,0)
2;RGB(255,255,255)
3;RGB(255,0,0)
4;RGB(0,255,0)
5;RGB(0,0,255)
6;RGB(255,255,0)
7;RGB(0,255,255)
8;RGB(255,0,255)
9;RGB(192,192,192)
10;RGB(128,128,128)
11;RGB(128,0,0)
12;RGB(128,128,0)
13;RGB(0,128,0)
14;RGB(128,0,128)
15;RGB(0,128,128)
16;RGB(0,0,128)
] (delimiter is ';' ) ;
Data_TMP:
NoConcatenate
load * inline [
SalesID,SalesLine,Qty
S1000,1,25
S1000,2,6
S1000,5,12
S1005,3,27
S1005,4,16
S1008,1,4
S1008,2,21
S1008,3,47
];
DistinctSalesID:
NoConcatenate
Load Distinct
SalesID
Resident Data_TMP;
MapColor:
Mapping
Load
SalesID,
ApplyMap('MapPalette',RecNo()) as [RGB Color]
Resident DistinctSalesID;
Drop Table DistinctSalesID;
Final:
Load *,
ApplyMap('MapColor',SalesID) as [RGB Color]
Resident Data_TMP;
Drop Table Data_TMP;
That works perfectly - many thanks!