Discussion board where members can get started with Qlik Sense.
I am writing if condition in script.
Is there any limit that we can use only this many if conditions in single column defination?
As per my knowledge there no limit for using nested if condition. but it will make an impact in performance.
There are no theoretical limitations but as suggested by Arul, the performance will take big hit from it.
Prefer set analysis whenever possible and use variables to do preemptive selections. This will help with the performance and yet be useful as you want.
After some If conditions,
it's showing script error, any idea, why this was coming?
I am defining a hierarchy from one column from different table. There are 5 levels of data, i need to define it in script only. Any thoughts?
can you share the qvf
As sumit suggested multiple If statements will impact on the performance of your application, which is rightly so,
you can use variable to store your hierarchy levels. Alternatively you can use Class function, provided your intervals are constant.
Eg. Class(FieldName, 1000) will create multiple levels with the interval of 1000 for entire dataset of the field specified.
Coming back to your question about script error in the screenshot attached, you might have missed ')' parenthesis for conditions written.
Hi Milind, thanks for the reply.
It's not about the ')'. dimension name itself showing in red color.
I am not able to use 'class' since there is no fixed classification.
your expression looks fine. we need to check what is the cause
You can try to pawn of the data/column to variables. You can use the variables for the fields storage or the entire IF condition to it. That will take the conditional error issues.
You can have something in these lines:
let vConditionFirst=if(a>='10010' and b<='11000','yes', 'no');
let vConditionSecond=if(a>='10010' and b<='11000','yes', 'no');
Then in the script use the variables.
As an added bonus it will make the script look clean.