Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If Condition for Multiple Or values in scripting

Hi all,

I face the following problem.

I get error for following:

SAP System:

//    if([Billing Type]=('F2' or 'ZDOM' or'ZTRD' or'ZTRM' or'ZDEP' or 'ZEOU' or 'ZDEX' or 'ZSEZ' or'ZCON' or 'ZJBW'or 'JOB' or 'ZDR' or'ZPWR' or 'ZSTM'),Domestic,

//    if([Billing Type]=('ZEXP' or 'ZSEA' or 'ZQT'),Exports)) as Type,

Can someone let me know the syntax for writing OR inside If statement.

Thanks,

Saurabh.

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

Try the following:

If(Match([Billing Type],'ZEXP','ZSEA','ZQT')> 0,'Export',

If(Match([Billing Type],'F2','ZDOM','ZTRD','ZTRM','ZDEP','ZEOU','ZDEX','ZSES','ZCON','ZJBW','JOB','ZDR','ZPWR','

ZSTM')>0,'Domestic','Unknown'))

View solution in original post

6 Replies
khadeer
Specialist
Specialist

if([Billing Type]='F2' or [Billing Type]='ZDOM' or [Billing Type]='ZTRD' or [Billing Type]='ZTRM' or [Billing Type]='ZDEP' or [Billing Type]='ZEOU' or [Billing Type]='ZDEX' or [Billing Type]='ZSEZ' or [Billing Type]='ZCON' or [Billing Type]='ZJBW' or [Billing Type]='JOB' or [Billing Type]='ZDR' or [Billing Type]='ZPWR' or [Billing Type]='ZSTM','Domestic',if([Billing Type]='ZEXP' or [Billing Type]='ZSEA' or [Billing Type]='ZQT', 'Exports'))

Do max calculation parts in Edit script.

Anonymous
Not applicable
Author

You can use a match statement for multiple expected values of the same field.

if(match([Billing Type],'F2','ZDOM','ZTRD','ZTRM','ZDEP','ZEOU','ZDEX','ZSEZ','ZCON','ZJBW','JOB','ZDR','ZPWR','ZSTM',Domestic,

if(match([Billing Type],'ZEXP','ZSEA','ZQT'),Exports)) as Type

the above assumes you wanted to have a nested if statement and that Domestic and Exports are field names. If instead you want to have the words Domestic or Exports, encose in single quotes.

Jonathan

jagannalla
Partner - Specialist III
Partner - Specialist III

Hello,

Try this

if([Billing Type]= 'F2' or  [Billing Type]='ZDOM' or [Billing Type] ='ZTRD' or [Billing Type] = 'ZTRM' or [Billing Type] ='ZDEP' or [Billing Type] = 'ZEOU' or [Billing Type] = 'ZDEX' or [Billing Type] = 'ZSEZ' or [Billing Type] ='ZCON' or [Billing Type] = 'ZJBW'or [Billing Type] ='JOB' or [Billing Type] = 'ZDR' or [Billing Type] = 'ZPWR' or [Billing Type] ='ZSTM',Domestic) as Colname,

  if([Billing Type]='ZEXP' or [Billing Type]= 'ZSEA' or [Billing Type]= 'ZQT',Exports) as Type,

Cheers!!

Jagan

Anonymous
Not applicable
Author

Thanks.

They are Words so I will enclose in single quotes.

nagaiank
Specialist III
Specialist III

Try the following:

If(Match([Billing Type],'ZEXP','ZSEA','ZQT')> 0,'Export',

If(Match([Billing Type],'F2','ZDOM','ZTRD','ZTRM','ZDEP','ZEOU','ZDEX','ZSES','ZCON','ZJBW','JOB','ZDR','ZPWR','

ZSTM')>0,'Domestic','Unknown'))

Anonymous
Not applicable
Author

Thanks guys for all the replies.

Thanks for the multiple OR but what I was looking for is that match function.

Thanks jonbroughavone