Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How do I create a QlikView expression which loops through the values, modifying the background cell colour ?

Avatar of Tocogroup
TocogroupFlag for United Kingdom of Great Britain and Northern Ireland asked on
Software
2 Comments1 Solution1782 ViewsLast Modified:
Hi,

I have a pivot table object in my QlikView application which sets the background colour of a column's cell according to its value.

The object checks the value of a field (Status_ID) and then sets the colour depending on the value of another field (SPI Status). The idea behind this method is that I can 'customise' the values to be checked against, for each column. The example below shows what I mean - the values checked against are held in two fields, Upper_Threshold and Lower_Threshold.

If (Status_ID = 'SS001',
   If ([SPI Status] >= Upper_Threshold, RGB(255,0,0),
     If ([SPI Status] >= Lower_Threshold, RGB(255,128,0),Green()))
,If (Status_ID = 'SS002',
   If ([SPI Status] >= Upper_Threshold, RGB(255,0,0),
     If ([SPI Status] >= Lower_Threshold, RGB(255,128,0),Green()))
,If (Status_ID = 'SS003',
   If ([SPI Status] >= Upper_Threshold, RGB(255,0,0),
     If ([SPI Status] >= Lower_Threshold, RGB(255,128,0),Green()))
,If (Status_ID = 'SS004',
   If ([SPI Status] >= Upper_Threshold, RGB(255,0,0),
     If ([SPI Status] >= Lower_Threshold, RGB(255,128,0),Green()))

However, as there are 30 Status IDs this has resulted in a huge multi-IF statement. I would like to reduce this code to a loop using a variable for the Status ID values.

How would I go about coding this ? How do I declare a local variable in my expression ? Or do I set it up outside my expression ?

Thanks
Toco