Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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;
Thank you michelkr. Works like a dream! Have an awesome day.
Sergio
You're welcome. I just added another option to get the answer you need, with use of a mapping table.
Please mark the original question as answered, this way, it can also be helpful for others if they have a similar problem Have fun with QlikView!