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: 
tomdabek
Contributor III
Contributor III

How to make a data selection trigger?

Hello,

We have an application where customers can make 2 types of purchases - lets call them balls and sticks, the field is called 'SaleType'.

I would like to activate a trigger so when a user opens a particular sheet, only customers who have purchased both balls and sticks are selected.

Any guidance is appreciated.

Thank you.

7 Replies
marcus_sommer

Maybe with something like this as search-expression within a the trigger:

= '("' & concat({< SaleType = {'balls'}> * < SaleType = {'sticks'}>} distinct customer, '"|"') & '")'

- Marcus

jonathandienst
Partner - Champion III
Partner - Champion III

Are you sure that a trigger is the best way to do this? I would use set expressions that filter for both balls and sticks, rather than a triggered selection.

In a chart/table, something like

Sum({<Customer = P({<SaleType = {'balls'}>*<SaleType = {'sticks'}>} Customer)>} Sales)

(although its easier to develop and test something like this if you provide a sample qvw file)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Kushal_Chawda

Sheet on which you want to select the customers, go to sheet properties-> Triggers -> Add Action on Activation of sheet -> Add->Selections->Select in Field->

Field : Customer

Search Staring : ='(' &concat(distinct {<SaleType={'Balls'}>*<SaleType={'sticks'}>} chr(34) & Customer & chr(34)) &')'

tomdabek
Contributor III
Contributor III
Author

So I haven't had much luck with this.  I have tried a few things using the suggestions above.

Right now as a trigger I have:

='(' &concat(distinct {<ROCKApplication={'AGG'}>*<ROCKApplication={'Fill'}>} chr(34) & %customer & chr(34)) &')'

on the field %customer

However, when the sheet is activated, I cannot see anything in the 'Current Selections Box'.

Should this appear in the current selection box?

I have tried another trigger, on a different field, and in the Search String i just have (AGG|Fill) and while it does not accomplish what i am trying to do, at least in the current selections box i can see that these fields have been selected.

Kushal_Chawda

Try this


='(' &concat(distinct {<ROCKApplication={'AGG'}>*<ROCKApplication={'Fill'}>} chr(34) & %customer & chr(34), ', ') &')'

marcus_sommer

The delimiter for the dimension-values needs to be the pipe-sign '|' and not the comma.

- Marcus

Kushal_Chawda

I think with single quotes and comma its works. Not sure

='(' &concat(distinct {<ROCKApplication={'AGG'}>*<ROCKApplication={'Fill'}>} chr(39) & %customer & chr(39), ', ') &')'