Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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
gsbeaton
Luminary Alumni
Luminary Alumni

Hi Sada,

It would be handy if Qlik script supported a CASE or SWITCH type function for these scenarios, but I find an easy, and very maintainable and importantly efficient solution is to create a temporary mapping table and then use the applymap() function.

Here's the idea, give it a whirl:

T1:

LOAD * INLINE [

Min, Max, Name

551000, 551001, COGS - Credit Sales

502000, 502001, COGS - Cash Sales

];

GL_Names:

Mapping Load

Min + (iterno()-1) as GL_AccountNumber

,Name

Resident T1

While Min + (Iterno()-1) <= Max;

Drop table T1;

MainTable:

Load *,

   ApplyMap('GL_Names',GL_AccountNumber) AS GL_Name

From DataSource;

Code is untested, but should give you a good idea on how you can solve the problem elegantly - not an IF statement in sight .