Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
sridhar_sigired
Creator
Creator

Alternate to Nested if condition

Hi,

I have nested if condition something like below (too nested).

IF (A like 'AZK*' , 'Azzar',

IF (A like 'VDN*' , 'Vodapone',

IF (A like 'WB*' , 'WorldBlue',

IF (A like 'wow*' , 'WOW! Security',

IF (A like 'ZA*' , 'ZoneAlarm',

IF (A like 'ys*' , 'sdgrsw',

'Unknown')))))

Can i use Match or any other function to avoid this nested IF??? for better performance?

Regards,

Sridhar

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Pick(WildMatch(A ,'AZK*' , 'VDN*','WB*','wow*','ZA*', 'ys*')+1, 'Unknown', 'Azzar', 'Vodapone','WorldBlue','WOW! Security', 'ZoneAlarm','sdgrsw')

View solution in original post

7 Replies
sunny_talwar

Try this:

Pick(WildMatch(A, 'AZK*', 'VDN*', 'WB*', 'wow*', 'ZA*', 'ys*', A), 'Azzar', 'Vodapone', 'WorldBlue', 'WOW! Security', 'ZoneAlarm', 'sdgrsw', 'Unknown')

tresesco
MVP
MVP

Pick(WildMatch(A ,'AZK*' , 'VDN*','WB*','wow*','ZA*', 'ys*')+1, 'Unknown', 'Azzar', 'Vodapone','WorldBlue','WOW! Security', 'ZoneAlarm','sdgrsw')

sridhar_sigired
Creator
Creator
Author

May i know why we have used +1 here?

tresesco
MVP
MVP

If there would be no match, wildmatch() would return 0, otherwise it's match index . By adding 1 to 0, pick() is told to pick the 1st text, i.e- 'Unknown'. For rest of the matched values, position is deferred by 1. Hope this helps.

sridhar_sigired
Creator
Creator
Author

Hi Sunny,

Unknown used here as for if not else, not to replace as 'A'. Can you clear the confusion?

sunny_talwar

In the new field that will be created you want it to be called 'Unknown', if it doesn't match any other names that we listed within WildMatch()?

sridhar_sigired
Creator
Creator
Author

OK Let me try yours and from tresesco. And take the one which is working. Thank you.