Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Conditionalize the colour of textboxes

Hi,

in a table object in my current document I work with some white textboxes to generate white inbetween-space. Since these can be tricky to spot, I would like to make them "light up" in a different colour when I make some development changes to the document:

I have introduced a variable v_DevMode and I would like to specify two alternate colours for the textboxes - but that is the problem: I can conditionalize one colour, so the textbox will not appear at all when that condition is not true, but I cannot specify a second colour unless as a colourmix, which I don't want. I want two alternate opaque colours.

I know that in an SQL expression I can specify the colour for my text using the RGB function, but can I also use the same method to specify a background colour?

Thanks a lot!

Best regards,

DataNibbler

2 Replies
Gysbert_Wassenaar

Open the properties window for the text object. Click on the Color button. Check the option Calculated and enter an expression in the input box (or open the expression editor). You can enter an expression to calculate the color. Something like if(v_DevMode=1, color(1), rgb(200,50,50))


talk is cheap, supply exceeds demand
datanibbler
Champion
Champion
Author

Hi Gysbert,

so I actually use the colour I have set in the dialog itself as the "then-option" in that IF-clause and I specify a different one using the RGB function as "else-option"?

That seems to work - one thing is strange, though: I want the textbox to be red (218, 20, 66) when v_DevMode='Y' and when I set v_DevMode to 'N', it should be white - but currently, v_DevMode='Y' and the function parameter color(1) returns baby-blue 😉 I guess that function uses some internal palette - the help says it uses the palette of the diagram - but where can I check that? The properties dialog for the straight table object has no "colours" tab where I could check the order of the colours...

Best regards,

DataNibbler