Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an expression that is essentially:
if exp1 is not null then
exp1
else
exp2;
if exp2 is not null then
exp2
else
exp3;
etc...
if expn is not null then
expn
else
'Unknown';
I can't do this in the load statement because each of these expressions are based off of user input. Essentially, I have a hierarchy classifications. A record could have a value for several different sources of classifications and the user can change their hierarchy (preferred order of classifications) for all securities. Some securities may only have classifications from a classification source that the user does not select, which is the reason for the 'Unknown' at the end of the nested if. I'm hoping there is a better way to do this process in QV as it will be pervasive across many reports and I expect would hit performance. Any suggestions would be greatly appreciated.
You could try it with the function alt().
- Marcus
This: http://community.qlik.com/docs/DOC-5841 might help, hopefully.
That link says at the end that the speed compared to a nested if was not any different. Is my assumption that nested ifs are big hits to performance?
If-Statements are always slow. But you could try it with conditions on the expressions - this means you have no nested if then only the expression(s) with a valid condition will be displayed.
- Marcus
alt(exp1,exp2,exp3,exp4,'Unknow')
does alt only work on numbers?
Yes
Is alt significantly faster than a nested if? I can probably convert the field i'm working with to duals, allowing alt to work on them but return the strings I need.
I´ve never tested speed of both.
I generally use it because is much 'cleaner' to read and mantain