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: 
manoranjan_d
Specialist
Specialist

if loop with or condition

Hi all,

below is my if loop condition

if(role_id='Adm' or 'Mgr' or 'Read' or 'User' or 'USER','USER','ADMIN') as ACCESS,

this conidtion is not working int he load script level.

for the value 'User' it showing ADMIN value.

let me know the issue on this

6 Replies
Anil_Babu_Samineni

You have to declare fieldname to each value

if(role_id='Adm' or role_id='Mgr' or role_id='Read' or role_id='User' or role_id='USER','USER','ADMIN') as ACCESS,

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MarcoARaymundo
Creator III
Creator III

try this

if(match(role_id, 'Mgr', 'Read', 'User', 'USER', 'USER', 'ADMIN',

     'if true',

     'if false'

) as ACCESS,

MarcoARaymundo
Creator III
Creator III

Opps!

if(match(role_id, 'Mgr', 'Read', 'User', 'USER', 'USER', 'ADMIN'),

     'if true',

     'if false'

) as ACCESS

Anonymous
Not applicable

Hi Please use this

You have to use role_id each time

if(role_id='Adm' or

role_id='Mgr' or role_id='Read' or role_id='User' or role_id='USER',

'USER','ADMIN') as ACCESS,

Kushal_Chawda

try this

if(match(lower(role_id) ,'adm' ,'mgr' ,'read' ,'user' ),'USER','ADMIN') as ACCESS,

Colin-Albert

Use MixMatch() for a case insensitive test

if(MixMatch(role_id, 'Adm' , 'Mgr' , 'Read' , 'User'), 'USER', 'ADMIN') as ACCESS,



There are several match functions available  match(). mixmatch() and wildmatch() depending on whether you want a case sensitive test, as case insensitive test or wildcard test.