Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create Button Action Based on Criteria

Hi

I am trying to implement a simple button to make a selection dynamically, but am trying to get my head around the "Select in Field" action.

I have 3 fields: CitizenID, ResidenceTown, WorkTown

I want to make the button to select only CitizenID where ResidenceTown = WorkTown.

Have tried the below but it isn't working.

Capture.JPG

Any tips would be great!

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Chay,

='(' & Concat(Distinct If([WorkTown] =[ResidenceTown] ,CitizenID),'|') & ')'

View solution in original post

8 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Have you tried making a simple flag in the script:

Load *

     ,If(ResidenceTown = WorkTown, 1, 0) as CitizenFlag

From Source;

Then in the Action tab Field you you write CitizenFlag and in the Search String 1.

Not applicable
Author

Hi

My ResidenceTown and WorkTown fields are in different tables, hence I'm unable to use the Flag method

lironbaram
Partner - Master III
Partner - Master III

hi

you'll need to use an expression that creates a list on customers as an output

so you'll need to use in the search string something like

='(' & concat(aggr(if([WorkTown]=[ResidenceTown],CitizenID),CitizenID),'|') & ')'

tamilarasu
Champion
Champion

Hi Chay,

='(' & Concat(Distinct If([WorkTown] =[ResidenceTown] ,CitizenID),'|') & ')'

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Also, for more clarification the action Select in Field works like this.

You choose the Field and the Search String you can write the possible values from the Field.

For example in the Field you've written CitizenID. It contains data like (1, 2, 3, 4 and so on). In this case Search String means you have to write down the CitizenID like 4.

Not applicable
Author

Thanks Tamil

Works well.

tamilarasu
Champion
Champion

Hi Chay,

I forgot to mention one point. If your CitizenID contains any spaces like "ID 0001" then above method won't work. To be on the safer side, you can write like

='(' & Concat(Distinct If([WorkTown] =[ResidenceTown],Chr(34) & CitizenID & Chr(34)),'|') & ')'

This expression works in both the cases.

trdandamudi
Master II
Master II

One more way of doing this is as follow: Hope this helps.....

='(' & concat( {<CitizenID={"=WorkTown=ResidenceTown"}>} CitizenID, '|')  & ')'