Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
This will be a very easy one.
I have an expression in my load script and I am doing an if expression
if((PG = 'CAC' and PG = 'Sa'), 'Y', 'N') as PG_FLAG
I keep getting only N when I do a reload and I know that I should be getting Y.
What's wrong with my script.
Thanks
Your set analysis expression is an OR where you are saying PG = 'CAC' or 'SA'.
Logically the value in PG can only be one value or another hence when you use AND the condition can never be true.
Regards,
Gordon
Hi,
Instead of And use Or. like
if((PG = 'CAC' or PG = 'Sa'), 'Y', 'N')
Regards,
Kaushik Solanki
Hi,
Note that QlikView is case sensitive for both field names and values, so the field should be called PG and the possible values in the conditional "CAC" (all uppercase) and "Sa" (mixed).
Besides, one field (PG) cannot have two different values in the same record, so you will have to change it to OR instead of AND, or do something different.
Is that correct?
BI Consultant
Hi guys,
Thanks for your quick reply.
My field PG has values of Sa, CAC, Ln and so on.
I have a chart with set analysis PG ={'CAC', 'Sa'}
I am just trying to remove the set analysis bit and put it in the script instead to improve performance
Using "OR" will mean it will be Y for either choice. I want it to only be Y for both choices.
I hope I have been clear enough.
Thanks for your anticipated help
Hi,
Yes you are right or means either choice.
So according to the statement it will only assign Y when your field value is CAC or Sa.
If there is any value other than this, it will assign N.
Regards,
Kaushik Solanki
Your set analysis expression is an OR where you are saying PG = 'CAC' or 'SA'.
Logically the value in PG can only be one value or another hence when you use AND the condition can never be true.
Regards,
Gordon
Thank you all for your helpful responses