Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
alerse
Contributor II
Contributor II

How to change the colour of a text object based on data

Hi

I'm still very new to QV but want to build a little app where the text object changes colour based on a value I get from a excel file. For example: If the value is less than 50, the colour must be red and above 50 it must be green.

Any help will be appreciated!!

Thanks,

Eon

1 Solution

Accepted Solutions
Not applicable

Hi, This could be done by writing a simple code in 'Text Color' property of an expression.

The code is:

=If(value>50,Green(),Red())

View solution in original post

5 Replies
Not applicable

Hi, This could be done by writing a simple code in 'Text Color' property of an expression.

The code is:

=If(value>50,Green(),Red())

alerse
Contributor II
Contributor II
Author

Hi Amit

Thanks for your quick reply!! CAn you please explain what you mean by expression? When I right click on the text object there is only the actions tab where I can enter some code.... Where do you sugggest I put this code?

Sorry, I'm very new to QV!

Thanks,

Eon

Not applicable

Hi Eon,

I think what Amit is describing is the following (I am using 8.5 SR5):

  1. Right click on the text object
  2. Make sure the General tab is selected
  3. In the bottom left corner, click the colour patch to the right of the radio button marked Color
  4. The Color Area dialog will then appear
  5. Click the Calculated radio button
  6. Enter the expression Amit provided (as modified for your data) into the expression window to the right of the radio button you just clicked
  7. Click OK on the Color Area dialog
  8. Click OK on the Text Object Properties dialog

Hope this is of some help.

Rod

alerse
Contributor II
Contributor II
Author

Thanks!

Not applicable

Has anybody any idea how to do this with Qlikview 11.0?