Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
michaeldburt
Partner - Contributor III
Partner - Contributor III

Select in Field if Statement

Hi Everyone-

I'm using the select in field action as part of a button, to select a number of values from a list box.  Based on the if statement, there can be as few as 1 and as many as 12 values selected.  I'm unsure of the syntax for defining the expression, and for defining the values.

My expression:

if( sum(Sales) > 80, FieldValue1, FieldValue2, FieldValue3, etc...)

so, when I click on the button, if the FieldValue's sum(Sales) is > 80, it will automatically be selected.

Any ideas?

1 Solution

Accepted Solutions
8 Replies
sunny_talwar

Selected values need to be in this format for the selection to work:

("Value 1"|"Value 2"|"Value 3")

For a better help, it would be great if you can share a sample with us.

Best,

Sunny

michaeldburt
Partner - Contributor III
Partner - Contributor III
Author

Hi, thanks for the response.  This is how is originally had my expression set up, with the '("Value1"|"Value2"|"Value3")' syntax.

The problem that I was running into is that even Values that did not meet the criteria were being selected.

sunny_talwar

Can't say much without looking at a sample. Would you be able to share one?

maxgro
MVP
MVP

maybe

='(' & '"' & concat({$ <Field={"=sum(Sales)>80"}>} Field, '"' & '|' & '"') & '"' & ')'

michaeldburt
Partner - Contributor III
Partner - Contributor III
Author

Not sure that I understand what the above is trying to accomplish MG

michaeldburt
Partner - Contributor III
Partner - Contributor III
Author

Cannot share sample.  Can share an example:

I have a field, called Town.  Town has 4 values, TownA, TownB, TownC, TownD

I have an expression.  sum(Sales)

I have a button, with a Select in Field action.  When I click this button, I want it to select in Town, the towns that have sum(Sales) >= 80.

For reference, TownA has sum(sales) of 75, TownB has sum(sales) 85, TownC has sum(Sales) or 82, and TownD has sum(Sales) of 75.

My first attempt at using the if statement was:

if( sum(Sales) >= 80 , '("TownA"|"TownB"|"TownC"|"TownD")' )

I wanted this statement to select TownB and TownC, but it selected all the Towns.  I'm trying to get it so that only B and C are selected.  But, this does need to be dynamic, as TownB and TownC won't always fit the condition.

maxgro
MVP
MVP

see the attachment

michaeldburt
Partner - Contributor III
Partner - Contributor III
Author

That is it.  Thank you