Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Hi,
As per my knowledge there no limit for using nested if condition. but it will make an impact in performance.
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
Hi Arul,
After some If conditions,
it's showing script error, any idea, why this was coming?
Regards,
Sadasiva
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
can you share the qvf
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.
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
your expression looks fine. we need to check what is the cause
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.