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

Help with an IF statement in the Load

How to translate this IF statement in Qlikview statement ?

If

(

left([Account ID], 3) in ('105','104','530','550','580','730','750','751','830','850','901')  and left ([Purchase Order], 1) in ('1','2','5','7','8') and left ([Project ID], 1) in ('0','4')

) then ('NonCapital - Direct')

else If

(

left([Account ID], 3) in ('105','104','530','550','580','730','750','751','830','850','901')  and left([Purchase Order], 1) in ('1','2','5','7','8') and left ([Project ID], 1) in ('1')

) then ('NonCapital -MtestIndirect')

else if

(

left([Account ID], 3) in ('105','104')  and left([Purchase Order], 1) in ('1','2','5','7','8') and [Project ID] is null ) then ('NonCapital - MTest')

else  ('Undefine')

Thanks,

Henness

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think you can replace the in using match() function and use the if() statement with then,else branch included as arguments and separated by commas:

If

(

match(left([Account ID], 3),'105','104','530','550','580','730','750','751','830','850','901')  and match(left ([Purchase Order], 1),'1','2','5','7','8') and match(left ([Project ID], 1),'0','4')

, 'NonCapital - Direct'

, If

(

match(left([Account ID], 3),'105','104','530','550','580','730','750','751','830','850','901')  and match(left([Purchase Order], 1),'1','2','5','7','8') and match(left ([Project ID], 1),'1')

,'NonCapital -MtestIndirect'

, if

(

match (left([Account ID], 3),'105','104')  and match(left([Purchase Order], 1),'1','2','5','7','8') and isnull([Project ID]) ,'NonCapital - MTest'

,'Undefine'

)))

Hope I haven't forgot too many brackets,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

I think you can replace the in using match() function and use the if() statement with then,else branch included as arguments and separated by commas:

If

(

match(left([Account ID], 3),'105','104','530','550','580','730','750','751','830','850','901')  and match(left ([Purchase Order], 1),'1','2','5','7','8') and match(left ([Project ID], 1),'0','4')

, 'NonCapital - Direct'

, If

(

match(left([Account ID], 3),'105','104','530','550','580','730','750','751','830','850','901')  and match(left([Purchase Order], 1),'1','2','5','7','8') and match(left ([Project ID], 1),'1')

,'NonCapital -MtestIndirect'

, if

(

match (left([Account ID], 3),'105','104')  and match(left([Purchase Order], 1),'1','2','5','7','8') and isnull([Project ID]) ,'NonCapital - MTest'

,'Undefine'

)))

Hope I haven't forgot too many brackets,

Stefan

Anonymous
Not applicable
Author

Thank you for your help !! It works !!