Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

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

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: if statement help

Thank you michelkr. Works like a dream! Have an awesome day.

Sergio

3 Replies
Not applicable

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;

Not applicable

Re: if statement help

Thank you michelkr. Works like a dream! Have an awesome day.

Sergio

Not applicable

Re: if statement help

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!