Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
Talk to Experts Tuesday, Live Q&A, September 22: Moving from QlikView to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Assign colour using value in data


If, in my fact table, I have a unique ID field, a name, and a field called ColourRGB how do I use content of the field "ColourRGB" to specify the background colour of my Straight Table Chart?

IDNameColourRGB
123||2|1Fred Blogs
123||3||2John SmithRGB(250,0,0)
214||99|12Ann Niting-Ale
513||16||1Wilma KarstartRGB(0,248,0)
114||7|8Ray Dargunn

I would like the background colour of the 2nd row to be red as specified by RGB(250,0,0) and the 4th row to be green - RGB(0,248,0)

I have tried various expressions in "Background Color" of each field -

$(=ColourRGB)

if(IsNull(ColourRGB),RGB(255,255,255),$(=ColourRGB))

if(len(ColourRGB)=0, RGB(255,255,255),$(=ColourRGB))

if(IsNull(ColourRGB),RGB(255,255,255),RGB(250,0,0))

Obviously the fourth attempt coloured the 2nd row red but, of course, the 4th was red also - this is what I would expect. But, how do I get it to use the content of the field ColourRGB instead?

Incidentally, the background colour does get coloured appropriately when I click on the ID of the row concerned filtering the table to just one record.

The end result should look like this:

IDNameColourRGB
123||2|1Fred Blogs
123||3||2John SmithRGB(250,0,0)
214||99|12Ann Niting-Ale
513||16||1Wilma KarstartRGB(0,248,0)
114||7|8Ray Dargunn

I feel like I'm nearly there, just not quite got it right.

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

$ sign expansion is evaluated at chart level, so not at row level for each value in the dimension. Instead of loading  rgb(250,0,0), load three fields e.g. r,g,b and use the background color expression

=rgb(r,g, b)

View solution in original post

4 Replies
Highlighted
Partner
Partner

$ sign expansion is evaluated at chart level, so not at row level for each value in the dimension. Instead of loading  rgb(250,0,0), load three fields e.g. r,g,b and use the background color expression

=rgb(r,g, b)

View solution in original post

Highlighted
Partner
Partner

See attached example

Highlighted
Creator II
Creator II

Excellent! Thanks Stigchel, that worked perfectly.

Highlighted
Partner
Partner

You're welcome