Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ramyasaiqv
Creator II
Creator II

Is there a better way to write this in Qlik script

Hello Community,

I have  written a nested if function to achieve this but was wondering is a there a better way to write the same in qlik script using qlik functions? please give me your inputs.

if( Name='AK', 'Yes' ,

if( Name='KK', 'Yes' ,

if( Name='MK', 'Yes' ,

if( Name='TK', 'Yes' ,

if( Name='HK', 'Yes' ,

if( Name='BK', 'Yes' , 'No'))))) as Main

Thanks,

Ramya

1 Solution

Accepted Solutions
jheasley
Creator III
Creator III

If (match(Name,'AK','KK','MK','TK','HK','BK'),'YES','NO') as Main


OR


If (Not match(Name,'AK','KK','MK','TK','HK','BK'),'NO','YES') as Main

View solution in original post

2 Replies
shivanandk
Partner - Creator II
Partner - Creator II

If (match(Name,'AK','KK','MK','TK','HK','BK')>0,'Yes','No') as Main

jheasley
Creator III
Creator III

If (match(Name,'AK','KK','MK','TK','HK','BK'),'YES','NO') as Main


OR


If (Not match(Name,'AK','KK','MK','TK','HK','BK'),'NO','YES') as Main