Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nishika
Partner - Contributor III
Partner - Contributor III

GetFieldSelections not working with AND condition though working with OR in If condition

=IF(GetFieldSelections(SalesOffice)='NA38' AND GetFieldSelections(SalesOffice)='NA40' ,100,60)

Labels (1)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

GetFieldSelections will return multiple value separated by commas in a single string if multiple values are selected, so the comparison to a single value in a string will not work.

Try this:

if(GetSelectedCount(SalesOffice)>0 and
Match('NA38',$(=concat(distinct chr(39)&SalesOffice&chr(39),',')))>0 and
Match('NA40',$(=concat(distinct chr(39)&SalesOffice&chr(39),',')))>0,
100,60)

View solution in original post

6 Replies
GaryGiles
Specialist
Specialist

GetFieldSelections will return multiple value separated by commas in a single string if multiple values are selected, so the comparison to a single value in a string will not work.

Try this:

if(GetSelectedCount(SalesOffice)>0 and
Match('NA38',$(=concat(distinct chr(39)&SalesOffice&chr(39),',')))>0 and
Match('NA40',$(=concat(distinct chr(39)&SalesOffice&chr(39),',')))>0,
100,60)

nishika
Partner - Contributor III
Partner - Contributor III
Author

Thankyou its working 🙂

 

nishika
Partner - Contributor III
Partner - Contributor III
Author

GetFieldselections not working with AND Condition with different dimensions

=If(GetFieldSelections(Crop)='Tomato' and GetFieldSelections(Species)='Tomato',1,0)

Please help for this Expression @GaryGiles 

I have tried this  below expression but it is not working.

=if(GetSelectedCount(Crop)>0 and GetSelectedCount(Species)>0 and
Match('Tomato',$(=concat(distinct chr(39)&Crop&chr(39),',')))>0 and
Match('Tomato',$(=concat(distinct chr(39)&Species&chr(39),',')))>0,
1,0)

please help

GaryGiles
Specialist
Specialist

That looks like it should work.  Are you sure that Tomato is selected in both Crop and Species and that a fact row exists for that combination?

 

nishika
Partner - Contributor III
Partner - Contributor III
Author

yes  I have selected both and fact row exists for both combinations. But not working.

Is there any other expression which helps me when user select Crop = Tomato and Species = Tomato then only chart should be visible?

GaryGiles
Specialist
Specialist

Can you post the results of these 2 expressions with and without the selections made?

concat(distinct chr(39)&Crop&chr(39),',')

concat(distinct chr(39)&Species&chr(39),',')