Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Abhishekb
Contributor III
Contributor III

Alternative or Optimized way for nested if conditions.

Hi Community,

if I have a condition like below,

if(condition and (condition or condition), Statement1,

    if(condition and condition or condition, Statement2,

        if(condition and condition or condition, Statement3,

            if(condition and condition or condition, Statement4,

                if(condition and condition or condition, Statement5,

                    if(condition and condition or condition, Statement6,

                       if(condition and condition or condition, Statement7,

                          if(condition and condition or condition, Statement8,

                             if(condition and condition or condition, Statement9,

..........................if(condition and condition or condition, Statement N,Other)))))))))) as Somthing;

Kindly say the best optimised way for this....

Thanks in Advance.

Abhishek B

4 Replies
vincent_ardiet_
Specialist
Specialist

Difficult to say without knowing what are the conditions and the statements.

Abhishekb
Contributor III
Contributor III
Author

Hi @vincent_ardiet_ ,

Can you kindly give a try, how can we apply any function.

marcus_sommer

There is no general approach else it will always be depending on the exact requirement which kind of matching is possible and sensible, for example are it always/mainly the same fields in the condition and the results or different ones and/or the order of the checks essentially or not and many things more ...

Beside this I suggest to consider to resolve the need for a nested if-loop in beforehand by creating appropriate matching-data. Means instead hard-coding n fixed conditions within an if-loop the relevant information could be stored in an Excel/Inline table and then loaded against each other.

Abhishekb
Contributor III
Contributor III
Author

Hi @marcus_sommer ,

Thanks for your reply. I will take your advice.