Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Apply condition for all expressions

Is there anyway to apply entire row making color based on condition?

I' m using the following condition for one expression and it is working fine without any issues. Main issue is that I have to apply this condition to all expressions in the straight table object. Current Table having 164 expressions.

Instead of copying same script to all expressions, Is there any way to read all expressions one time by using script?

Ex:

if(ChangeCaptured = '<--', RGB(255,0,0),

  if(ChangeCaptured = '-->', RGB(0,0,255), RGB(255,255,255))

  )

Please, help me to fix this issue ASAP.

5 Replies
rupamjyotidas
Specialist
Specialist

You can take help of 'custom format cell'

press CTRL G then right click on top of the table , select 'custom format cell'

Not applicable
Author

If it is only one condition, it should works for custom format cell. I do have multiple conditions like below,

if(ChangeCaptured = '<--')  then TextColor = Red

if(ChangeCaptured = '-->')  then TextColor = Blue

if(ChangeCaptured = '<--'>)  then TextColor = Black

johnw
Champion III
Champion III

What I do in a case like this won't help with needing to repeat the expression. But it would make it much easier to modify if you want to change colors later. First thing is I would use a variable, like vColor. And you could set it to the expression you're currently using. However, if your expression depends only on the ChangeCaptured field, you might want to load the colors in script. Something like this:

[Colors]:
LOAD
ChangeCaptured
,rgb(R,G,B) as Color
INLINE [

ChangeCaptured,R,G,B

<--,255,0,0
-->,0,0,255
<-->,0,0,0
...
];

Then you could just use Color as your color expression. But it still might be safer to use a variable, even if that variable is just set to Color right now, because again, it's easier to modify later if, say, you decide you need to take more than just the ChangeCaptured into account when setting the color.

Not applicable
Author

After I added color expression, still I can't see color for the attribute "ChangeCaptured". Now I can see the data for this color expression as like this RGB(0,0,255) or RGB(255,0,0) or RGB(0,0,0)

johnw
Champion III
Champion III

I'm not sure quite what you're saying, but I looked up a working example in case that helps.

[Types]:

LOAD

[Type]

,rgb(R,G,B) as [Color]

INLINE [

Type,R,G,B

Actual,220,91,78

SRP,113,113,185

BP,109,147,188

Act,143,173,39

Fcst,80,170,135

];

Capture3.PNG

Capture.PNG

Capture2.PNG