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

GetFieldselections not working with AND Condition

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

Please help

Labels (1)
1 Solution

Accepted Solutions
nishika
Partner - Contributor III
Partner - Contributor III
Author

Hi,

Here I found the solution for my question.

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.

=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)

View solution in original post

7 Replies
Anil_Babu_Samineni

First check in text object how it is coming based on that you can compare the value?

GetFieldSelections(Crop)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
nishika
Partner - Contributor III
Partner - Contributor III
Author

In Text Object , it is working fine . But not in chart

Anil_Babu_Samineni

I meant to say, When you use text object what is the output, can you show the result after you select Tomato from Crop?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
nishika
Partner - Contributor III
Partner - Contributor III
Author

Yes, when I select Tomato from Crop output is 0.

ngangrad_0-1610537478894.png

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

GetFieldSelections(Crop)  OUTPUT= Tomato

tresesco
MVP
MVP

Your second condition is failing because you are not selecting 'Tomato' from Species field. Select it and then check the result.

nishika
Partner - Contributor III
Partner - Contributor III
Author

Yes in Text box with both the selection or either of selection , working fine.

But in Chart in Conditional show with AND Condition its is not working though working with OR Condition

nishika
Partner - Contributor III
Partner - Contributor III
Author

Hi,

Here I found the solution for my question.

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.

=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)