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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changing the color of text in a straight table

Hi

I'm trying to format a text in a straight table in different colors but I cannot get it to work.

I am trying to change the colors of a date so that if a start date = today()-1 the date (2010-09-12) is written in red.

The formula I've written looks like this:

if

(

(

(

But the result is "RGB(0,0,0)"

I've also tried to type in RGB(255,0,0) but that doesnt work either. I'm running QV version 9.00.7502.8 SR5.

Any help would be highly appreciated!

Henrik

date(START_DATE)=date(today()-1),RED(),BLACK())



6 Replies
Not applicable
Author

You should try with this

If(date(START_DATE,DD-MM-YYYY')=Date(Today()-1,'DD-MM-YYYY'),Red(),Black()) and this formula will past in text formate

Not applicable
Author

Hi

It is still resulting in "RGB(0,0,0)"

johnw
Champion III
Champion III

Your expression looks completely messed up in my browser, but piecing it together, it looks like it's this?

=if(date(START_DATE)=date(today()-1),RED(),BLACK())

That works just fine for me. Let's start with the basics - You have a START_DATE field that's a date? You clicked on the + next to the dimension or expression, clicked on "Text Color", clicked on "Edit...", and then put that in as the expression?

Not applicable
Author

Yes the start date field is formatted as a date and I've done exactly as you write. I can get the text colored if I write the formula as this: =if(date(START_DATE)=DATE(TODAY()+1),blue(),blue()) but if I wrtie it correct like this: =if(date(START_DATE)=DATE(TODAY()+1),blue(),black()) then all the text comes out black. The formatting of both the start date and the result of today()+1 should be the same.

johnw
Champion III
Champion III

Well, I'm not sure what to say. Here's a working example using the expression you posted that you said isn't working. I'm on the exact same version as you, so it shouldn't be a version problem.

Not applicable
Author

I cannot see why this should not work in my application. I solved this though by changing the formula to this:

if(left(START_DATE,5)=(left(date(today()+1),5)),BLUE(), BLACK())

Now this works but it puzzles me why this works and not the original formula.