Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Several variables in a definition

Hello everyone,

I'm a beginner with Qlikview but I need your help about one thing. I've a dynamic crossed board with an expression which shows products which are not launched in the production. And in this one, I write a function in the category " background's colour", but in this function I need several IF because I want the line becomes red if it's very urgent, orange if we have to do  in the next two weeks and white if we are ahead of schedule.

I've the idea to do CTRL+ALT+V and name a variable for every if, for exemple :

- RED_COLOUR = if (sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName( if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) -WeekName(Today(0)) <= 4*7 ,lightred(),white())

- ORANGE_COLOUR = if (sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName( if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) - WeekName(Today(0)) =5*7 ,RGB(255,127,0),white())

But how to combinate them in the definition of the background's colour of my expression ? Or it's possible to put several IF in the same definitiion ?

Thanks for your help !

PS : Sorry for my english's level I'm french ^^

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Nest your if statements:

if (sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName(if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) -WeekName(Today(0)) <= 4*7 ,lightred(),

if (sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName(if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) - WeekName(Today(0)) <=5*7 ,RGB(255,127,0),white()))

You could also use a variable to store most of it and make the final expression more readable:

Variable vDeadline: sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName(if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) -WeekName(Today(0))

Color expression: if( $(vDeadline) <= 4*7, lightred(), if($(vDeadline) <= 5*7, rgb(255,127,0), white()))


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Nest your if statements:

if (sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName(if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) -WeekName(Today(0)) <= 4*7 ,lightred(),

if (sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName(if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) - WeekName(Today(0)) <=5*7 ,RGB(255,127,0),white()))

You could also use a variable to store most of it and make the final expression more readable:

Variable vDeadline: sum (if(Etat_Atelier='Pas Produit',NB_RP))>=1 and WeekName(if(Date_Liss>4000,Date_Liss+3*7,Semaine_Montage)) -WeekName(Today(0))

Color expression: if( $(vDeadline) <= 4*7, lightred(), if($(vDeadline) <= 5*7, rgb(255,127,0), white()))


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you very much ! It works