Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

mprsuper123
New Contributor

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
MVP
MVP

Re: Help with an IF statement in the Load

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

2 Replies
MVP
MVP

Re: Help with an IF statement in the Load

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

mprsuper123
New Contributor

Re: Help with an IF statement in the Load

Thank you for your help !! It works !!

Community Browser