Discussion Board for collaboration related to QlikView App Development.
I am using if nested, but I am having performance problems. I would like to know how does qlikview evaluate the conditions. I mean, if the first condition is true then the other "if" conditions are not evaluated? or do all "if" conditions are evaluated always?
If a=b -> True, then qlikview returns 1 and ignores the other "if" statements. Is this the real behaviour?
Please help me to understand!
Nested if-constructs are a performance-killer! I'm not absolutely sure but I believe that at first all branches of a nested-if-loop will be calculated and the evaluation which part is true comes at the last step.
Therefore is often better to use other techniques for this, for example the pick(match()) and/or alt or with a mapping or maybe set analysis. It will depend on your concrete scenario which (kind or combination of methods) suits best whereby in your case you could also use:
if(a=b or a=c or a=d, 1, 0)
or here another example:
alt(pick(match(a, 'b', 'c', 'd'), 1, 1, 1), 0)
I have experience such issue.
Yes I agree with you, that first all branches of nested if else loop calculated and because of that we face so much performance issue.
I see... Thank you Marcus... I have another question please, My if conditions are made with the following structure: if (a>0, 1, 0) ...how can I replicate it with pick/Match? , is it possible? ..or pick/match only works with equal "="?.
Please give a more practical example and some more details to where do you want to use it with which aim (script/gui, more fields included, as flag, ...?).
depends on requirement. Most of the time set analysis help me to resolve such issue.
Some time I have create flag in script or modify script.
I am using it on a variable which is called and executed from an object in gui (indicator).
I have changed "if nested" into "or", but I still have performance problems:
...(500 comparisons more)
I have 13 indicators with the same logic on a sheet. The problem is that the sheet takes 15 minutes to refresh and show the objects. (performance problem)
I am thinking that perhaps objects(indicator) does not support too much operations (execution of lines of code). What do you think?
I think an expression which makes more than 500 comparisations will be always perform very poorly. Therefore I think you will need a different approach by simplifying some of the parts by precalculating some parts within the script, creating clusters for your a,b,c ... and something more.
Like above mentioned you need to provide more details. If a,b,c are different fields or variables or expressions? Where should it be used - chart-type, textbox, .... which dimensions are included? What is the end-aim of it - delivering 0 or 1 is probably only an intermediate step?