Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is there any limit in using If condition in qlik?

Hi,

I am writing if condition in script.

Is there any limit that we can use only this many if conditions in single column defination?

Regards,

Sadasiva

10 Replies
arulsettu
Master III
Master III

Hi,

    As per my knowledge there no limit for using nested if condition. but it will make an impact in performance.

sumit_ranjan_pa
Former Employee
Former Employee

HI Sada,

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.

Thanks,

Sumit

Anonymous
Not applicable
Author

Hi Arul,

After some If conditions,Untitled1.png

it's showing script error, any idea, why this was coming?

Regards,

Sadasiva

Anonymous
Not applicable
Author

Hi Sumit,

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?

Regards,

Sadasiva

arulsettu
Master III
Master III

can you share the qvf

md_qlikview
Creator II
Creator II

Hi Sada,

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.

Anonymous
Not applicable
Author

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.

Regards,

Sadasiva

arulsettu
Master III
Master III

your expression looks fine. we need to check  what is the cause

sumit_ranjan_pa
Former Employee
Former Employee

Hi Sadasiva,

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.