Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a column called FLAG which has 2 values 0 and 1 , i need to display a word LSF when 1 is select NON-LSF when 0 is selected from the Flag list box?
Do i need to include this in the query ? or can a set the display value somewhere?
You mean just see it in a text box or something?
if(FLAG,'LSF','NON-LSF')
no , i mean i have list box which display o and 1 values, the column Flag has values o and 1 , so when i create a list box on that column , i get values 1 and 0 , instead i want NON-LSF and LSF , I have been writing case statements , like
case when flag =0 then Lsf
when flsg = 1 then non lsf end else,
But how do i write this in qlikview?i tried writing this in load statements but i got syntax error...
Ah, so you want the list box itself to display LSF and NON-LSF?
An easy way is to put the if() statement I wrote in a list box. Select <expression> instead of the field, and then enter the if() as an expression.
A better way is to build your flag in the script using the dual() function, something like this:
if(your flag condition here, dual('LSF',1), dual('NON-LSF',0)) as FLAG
Your flag will then normally display as text (such as in a list box), but has an underlying numeric value, so you can still do things like sum(Flag) or sum(Flag*Quantity), or whatever you wanted to do with a numeric flag.
I get syntax error if i add If statement in the scripts , how do we write expression for list box in the title?Please Help ....
If I understand what you're asking, you select <expression> instead of the field, and then enter the if() as an expression. However, you'd probably be better off fixing your syntax error and handling it in the script. If people stopped coding and tried a new approach every time they got a syntax error, no code would ever get written.
I have an expression with syntax below
=if(RFA_FLAG, dual('LSF',1), dual('NON-LSF',0)) as RFA_FLAG , and nothing is displayed in my list box...
OK, I've obviously confused you. In a list box, you would use the expression I gave you first:
if(RFA_FLAG,'LSF','NON-LSF')
In SCRIPT, in the load statement where you are currently loading or creating the RFA_FLAG, you would use the other expression:
if(your flag condition here, dual('LSF',1), dual('NON-LSF',0)) as RFA_FLAG
If you're loading the RFA_FLAG directly from your source, then your condition is just the flag itself, and again this would be in the load statement in your script:
if(RFA_FLAG,dual('LSF',1),dual('NON-LSF',0)) as RFA_FLAG
Thank you so much , now i got excactly what i was looking for 🙂