3 Replies Latest reply: Feb 28, 2013 3:14 AM by Michel Kruiskamp RSS

    if statement help

      Hi, im new here, please be kind......

       

      I need some assistance. I am trying to do a multiple IF statement with multiple inputs. My data is as follows;

       

      "0213";"2013-03-07";"AB"

      "0213";"2013-03-07";"CO"

      "0213";"2013-03-07";"HP"

      "0213";"2013-03-07";"LO"

      "0213";"2013-03-07";"MC"

      "0213";"2013-03-07";"OA"

      "0213";"2013-03-07";"PK"

      "0213";"2013-03-07";"PL"

      "0213";"2013-03-07";"PN"

      "0213";"2013-03-07";"SD"

       

      What I need to do is -

                                              if(sales_type) in ('AB','HP','OA','PK','PL') then 'TERM' else 'CASH'

       

      Any suggestions?

       

      Your assistance is appreciated.

       

      Thanks in advance.

       

      Sergio

        • Re: if statement help

          QlikView doesnt work with the in-operator.

          You could use if-statements:

           

          if(sales_type = 'AB' or sales_type='HP' or sales_type='OA' or sales_type='PK' or sales_type='PL, 'TERM', 'CASH')
          

           

          Another option is the apply-map operator.

          First, create a mapping table:

           

          MappingTable: 
          mapping load * inline [
          x, y
          AB,TERM
          CO, CASH
          HP,TERM
          LO, CASH
          MC, CASH
          OA,TERM
          PK,TERM
          PL,TERM
          PN, CASH
          SD, CASH
          ] ;
          

           

          Then, load your table with the applymap opeartor:

           

          LOAD
          applymap('MappingTable',sales_type)
          RESIDENT
          nameofsourcetable;