Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
Not applicable

Set background color based on value

Hi all,

I'm trying to set the background color for an expression based on a field value.

For my example table with just one row everything works fine, if there is a second row the background colour isn't set any more.

Ex.:

Fieldvalue T1_RGB:                        RGB(254,232,200)

Expression for background color:     =$(=only(T1_RGB))

Anyone an idea?

Regards

Thomas

5 Replies
Highlighted
er_mohit
Honored Contributor II

Re: Set background color based on value

are you want to change the colour of field value..?if this

then add expresion in text colour.
might be helpful you

Highlighted
Not applicable

Re: Set background color based on value

Hi,

No, i don't want to change the text color, but the color of the background.

But I think the problem is the same also for the text color.

Highlighted
MVP & Luminary
MVP & Luminary

Re: Set background color based on value

Trying to evaluate field values as expressions like you're trying is a pita. Try adding just the r,g,b values to your table instead of the expression and simply use rgb(r,g,b) as expression for the background color.

[T2_COLOR]:

LOAD * Inline [

    T2_RGB,r,g,b

    "RGB(254,232,200)",254,232,200   

    "RGB(253,187,132)",253,187,132       

];


talk is cheap, supply exceeds demand
Highlighted
Not applicable

Re: Set background color based on value

Separate r,g,b values are working fine. Thanks.

But why isn't it a good idea to put either "RGB(254,232,200)" or "(254,232,200)" as value in a table and use it indirect? Would it be at least possible to evaluate an expressin indirect, or isn't it working at all?

Highlighted
Not applicable

Re: Set background color based on value

Hi,

You can store the information as a color.

You can also use some aggregation functions (when it makes sense).

Please see attached

Hope it helps

Regards