Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set the color of a text object dynamically?

I am designing in QV 9 and need to set the background color of a text object dynamically. The color will be green if a certain value exists as a field value in the current table. This cannot be based on user selection; instead, it needs to look at all of the values for a given field and turn green if any row has a certain value.

Example from the attached QVW file:

I want to turn the background of the TX01 text object green if the Sheet1 table contains any rows with "DD" in the Name column.

Thanks for any ideas,

Peter

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

For some reason I can't figure out how to get it to ignore user selections because set analysis is not working. But here is the calculated formula you should use for the color:


max({1} aggr(if(Name='DD',1,null()),Name))*lightgreen()


Regards,

View solution in original post

5 Replies
vgutkovsky
Master II
Master II

For some reason I can't figure out how to get it to ignore user selections because set analysis is not working. But here is the calculated formula you should use for the color:


max({1} aggr(if(Name='DD',1,null()),Name))*lightgreen()


Regards,

Not applicable
Author

That was it, thank you!

montubhardwaj
Specialist
Specialist

there is another approach as well.

All you have to do is go to the properties of text box:

General --> color --> Base color --> calculated

and write the formula like

=if(fieldindex('Name','DD')<>0,lightgreen())

This will work.

Cheers,

Sharma

Not applicable
Author

Thanks much, Sharma. That is both simpler to read, and has no problems with the user selection. I expect to use this formula so I really appreciate the help.

vgutkovsky
Master II
Master II

I agree; Sharma's solution is better!