Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Coloring another field based on If(IsNull()

Hello Qlik Community,

So what i want to do is based on a null value in field1, apply a grey color on field2, when said IF does not apply keep the color white.

Is this possible in any way?

I know you can apply a color to field1 but have not found a way to apply the color to another field when the if statement is met.

I came up with this so far:

=If(IsNull([Field1]), ([Field2], Red()), White())

Thanks in advance.

G.

1 Solution

Accepted Solutions
Not applicable

Re: Coloring another field based on If(IsNull()

If I read this right, this is probably what you are after.

6 Replies
jsaradhi
Valued Contributor

Re: Coloring another field based on If(IsNull()

may be i am missing something here but why not put the if statement for background color of field 2?

if you want to change the color of Field2 column in your table, then the if statement for the color needs to be in the background color for that field...so click on the + sign to the left of Field2, double click on background color and put in the following expression:

if(isnull(Field1), rgb(150,150,150), white())

Re: Coloring another field based on If(IsNull()

IF takes only  two arguments so your expression will not work anyway....

Not applicable

Re: Coloring another field based on If(IsNull()

If I read this right, this is probably what you are after.

Not applicable

Re: Coloring another field based on If(IsNull()

Hello Geert!

Using a If clause as you expect, we can use a flag to "mark" a possible grey color condition.

Insert this condition on your script:

If ( IsNull(FIELD1),1,0)          as GreyColor

In your FIELD2, insert this condition for changing its color:

If (GreyColor = 1, QlikTechGray(), White())

You have many ways to do it, this is just one of them.

Regards,

Edécio Santos.

Not applicable

Re: Coloring another field based on If(IsNull()

I recommend that if you do make the background Red, change the text colour to white, as black is hard to read against a red background.

You do this by going to the Text colour and using similar logic, make the text white if the IsNull() returns true.

Not applicable

Re: Coloring another field based on If(IsNull()

Thanks for the fast replies guys i really appreciate it.

@Jonathan Gegg: The red color was just an example

To elaborate further on what i want to do, because i think i was not clear, apologies for that.

- I have a data set which I've added a master calendar, but some dates don't have values from the original data set.

- I have created several list boxes: Year, Month, Week#, etc to precisely select a time period.

- When i select January, as an example, the impossible or null values get grayed out in the list box.


what i am trying to create is make the list boxes grey out values prior to a selection based on the null values in my data set.


Kind Regards,


Geert



Community Browser