Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional color

Hi everyone,

I have a text box with a background color. I would like this background color to change according to the selection : if there is at least one selection in the document vs no selection. How can I do that ?

I have found in the color parameter of the text box that I can add a "calculated" color. I guess I can do something like "if (condition, RGB (x,y,z) , RGB (x,y,z))

But I don't know which function I can use for the condition...

Thank you for your help !

1 Solution

Accepted Solutions
mato32188
Specialist
Specialist

if( GetCurrentSelections()>0, RGB(), RGB())

ECG line chart is the most important visualization in your life.

View solution in original post

9 Replies
mato32188
Specialist
Specialist

Hi Laura,

if (GetCurrentSelection() > 0, ...)

Martin

ECG line chart is the most important visualization in your life.
its_anandrjs

Hi,

Write the expression in the Color Area

=if (GetSelectedCount(FieldName), RGB(251,241,10) , RGB (154,123,254))

Chart Properties >> Color >> BAse color Calculated >> =if (GetSelectedCount(FieldName), RGB(251,241,10) , RGB (154,123,254))

COlarSetting.png

Regards

Anand

Not applicable
Author

Thank you Anan.

What if I don't want to specify a field name ?  I just want my color to change if there is one selection in the document (no matter on which field) ?

its_anandrjs

Hi,

Then you can put the Or condition

=if (GetSelectedCount(Field1) > 0 or GetSelectedCount(Field2) > 0 , RGB(251,241,10) ,Green())

Regards

Anand

mato32188
Specialist
Specialist

if( GetCurrentSelections()>0, RGB(), RGB())

ECG line chart is the most important visualization in your life.
simenkg
Specialist
Specialist

you can try:

=if(sum(Aggr(sum(GetSelectedCount($Field)),$Field))>0, RGB(251,241,10) ,Green())

its_anandrjs

Hi Laura.

Here a solution for you in the text object write expression

Chart Properties >> Color >> Base color Calculated >>

=if(Count( Getcurrentselections ( ) ) > 0, QlikTechBlue() , QlikTechGray())


This works for all fields when ever any selection in the list box


Regards

Anand

Not applicable
Author

The 's' was missing in your first message, that's why it didn't work.

Thank you Martin

mato32188
Specialist
Specialist

Sorry for that

ECG line chart is the most important visualization in your life.