Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ruma_barman
New Contributor II

If statement using getfieldselections function is not working properly

Hi All,

I want to get an expression according to the sequence of values selected from a dimension using the following expression if(match(subfield(GetFieldSelections(KPIs),',',1),null()),sum(0),sum(Sales)). If statement is not working properly.

Is anything wrong here?

Thanks,

Ruma

1 Solution

Accepted Solutions
jaumecf23
Contributor III

Re: If statement using getfieldselections function is not working properly

Hi,

Try this:

if(isnull(subfield(GetFieldSelections(KPIs),',',1)),sum(0),sum(Sales))

8 Replies
jaumecf23
Contributor III

Re: If statement using getfieldselections function is not working properly

Hi,

Try this:

if(isnull(subfield(GetFieldSelections(KPIs),',',1)),sum(0),sum(Sales))

ruma_barman
New Contributor II

Re: If statement using getfieldselections function is not working properly

Hi Jaume,

Thanks for your response. Can you kindly check the pick match statement in the attached app.

It is working for subfield 1 and not for subfield 2.

Thanks in advance,

Ruma

jaumecf23
Contributor III

Re: If statement using getfieldselections function is not working properly

Try this:

if(isnull(subfield(GetFieldSelections(KPIs),',',2)),'KPI not selected','KPI selected')

ruma_barman
New Contributor II

Re: If statement using getfieldselections function is not working properly

Not this one.In the new qvf..there is one pick match statement.community.png

jaumecf23
Contributor III

Re: If statement using getfieldselections function is not working properly

Maybe this is what you need:

pick(mixmatch(subfield(GetFieldSelections(KPIs),',',1),'A','B','C'),'Aa','Bb','Cc')

pick(mixmatch(subfield(GetFieldSelections(KPIs),',',2),'A','B','C'),'Aa','Bb','Cc')

ruma_barman
New Contributor II

Re: If statement using getfieldselections function is not working properly

Hi Jaume,

First pick statement is working but not the second one.Can you share the qvf ?

jaumecf23
Contributor III

Re: If statement using getfieldselections function is not working properly

You're right, there was an issue. Try this:

pick(mixmatch(trim(subfield(GetFieldSelections(KPIs),',',1)),'A','B','C'),'Aa','Bb','Cc')

pick(mixmatch(trim(subfield(GetFieldSelections(KPIs),',',2)),'A','B','C'),'Aa','Bb','Cc')

ruma_barman
New Contributor II

Re: If statement using getfieldselections function is not working properly

It's working.Thanks a lot.

Community Browser