Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

change color conditionally in table box

Hello,

I need to change the colour of the values I've put in a table box if they are greater/ less than a certain value.

One way that I though would do this was to write the line below in "Calculation Conditions", where OS1 is the name of one of the columns in the table:

if ( OS1 < 7, red() )

But nothing happens 🙂 Could you give some hints on what I need to do?

Thanks alot,

Naeemeh

13 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, naeemeh

you have to put this expression in the Text or Background color by opening the expression with the PLUS-button or you can enter a fix value in Visual Cues

Not applicable
Author

Hi Martina,

Thanks for the reply. Could you explain it a bit more?

Where exactly do I need to go to write this expression for Text or Background Color?

Where is Visual Cues?

Thanks,

Naeemeh

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, naeemeh,

look at the example, the Visual Cues is the 6 Tab in properties

Not applicable
Author

Thanks a lot Martina.

I was using a table box before, so I changed it to a Straight table in Chart object and I found the stuff you were talking about Smile

There is another problem now! My table looks like this:

TestName OS1 OS2 OS3

Test1 val1 val2 val3

Test2 val1 val2 val3

Test3 val1 val2 val3

I need to compare (val1, val2, val3) in row Test1 with say 7, then (val1, val2, val3) in row Test2 with say 8 and so on.

I tried this in Text: if(FieldValue(OS1, 1) < 1000, lightred()) but this turns the whole column under OS1 to light red.

Can you help me with this?

Thanks,

Naeemeh

Not applicable
Author

Try with [OS1], [OS2] and [OS3] as references in the "Text color" or "Background color" expression (Iassume that OS1,OS2 and OS3 are expressions too).

Let me know if it helps.

Cheers.

Not applicable
Author

Hey,

What do you mean by "Try with [OS1], [OS2] and [OS3] as references "?

Can you give me more details?

what I've done so far is :

if ( FieldValue ( 'OS1', 1 ) > 750 and RowNo() = 1, lightred() )

which works, but when I add the values for the other rows, like row 14:

if ( FieldValue ( 'OS1', 14 ) > 65000 and RowNo() = 14, lightred() )

nothing happens. For some reason it only works for row 1.

I think I need to iterate through the rows under each OS# and compare values, but I don't know how

I can do this in QLikView!!!?

I appreciate any hints and helps 🙂

Thanks,

Naeemeh

Not applicable
Author

You should try to associate a value to Test1, Test2 & Test3 as inline table for example (limittest).

Then you should use an expression on background color such as:

if([OS1]>limittest,lightred(),lightgreen())

I hope it helps.

Not applicable
Author

Thanks a lot for the replies.

What you suggested, makes the whole column of OS1 red. Let me explain what I need to do:

I have a straight table like this:

TestOS1OS2OS3
A6718
B5817
C4916
D31015
E21114
F11213


I have put the Test field in Dimension and OS1, OS2 and OS3 fields in the Expression part.

Now I need to compare each cell under OS1 with a different value and change color. For example:

Compare OS1 at row 1 (which has a value of 6) to 7 and if it's less than 7, make it red.

Compare OS1 at row 2 (which has a value of 5) to 30 and if it's greater than 30, make it red.

Compare OS1 at row 23(which has a value of 4) to 9 and if it's greater than 9, make it red.

And so on to the last row. Then I need to do the same for OS2, 3, ......

What you suggested, compares the whole column to one value 🙂

Any suggestions?

Thanks,

Naeemeh

Not applicable
Author

But OS1, OS2, OS3 for Test "A" they all compare with 7, that's right?