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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to write a script for conditional color

Hi all,

Anyone could teach me how to write a script to have a conditional color (e.g. +ve figure shows red color; -ve figure shows black color).

Best Regards,

Alan

14 Replies
sunny_talwar

May be like this:

If(YourExpression > 0, LightRed(), Black())

and it needs to go here:

Capture.PNG

but you won't be able to include Target Variance (days) and 48 with different formatting in one text box objects. You can use two different text box objects and use the above for the object with the expression.

HirisH_V7
Master
Master

Hi ,

May be like this,

Data:

LOAD * INLINE [

    ID, Score

    1, 48

    2, -49

    3, 50

    4, -89

    5, 98

];

Output:

color text.PNG

In Expression Back Ground Color:

=if(Score>=0,Black(),LightRed())

There in place of '0'  you Can use your cut off value  ->  48.

PFA,

HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Thanks all,

I tried Sunny T's method (it is easier for me). Unfortunately, still unsuccessful.

Best Regards,

Alan

HirisH_V7
Master
Master

Hi,

Change your expression like this,

=IF(Num($(Close Debtor Provision Current)/1000,'#,##0')>=0,Black(),LightBlue())

Else Check  your variable once.It is giving your desired number or not .

Hope this helps,

Regards,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Thanks Hirish V,

But still unsuccesesful.

Best Regards,

Alan

sunny_talwar

Or even this:

=If($(Close Debtor Provision Current) >= 0, Black(), Blue())

HirisH_V7
Master
Master

Hi ,

Can your be able to share your app!!

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
HirisH_V7
Master
Master

Hi ,

Did gone through your variable output . Check it once.

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

same result, can't display the figure.