2 Replies Latest reply: May 30, 2012 12:15 PM by Henness Hao RSS

    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

        • Re: Help with an IF statement in the Load
          Stefan Wühl

          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