Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Setting variables based on Field selection

I have a field as follows:

Filter
A
B
C
D
E

and I have 5 variables as:

vA, vB, vC, vD, vE

I want to set these variables to true/false based on the selection of values in field. For example, if A and C are selected in field 'Filter', the variables vA and vC should be set to true and others should remain false.

Please suggest how it can be achieved.

Thanks!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

vA: =(max(match(Filter,'A')) and GetSelectedCount(Filter))

vB: =(max(match(Filter,'B')) and GetSelectedCount(Filter))

etc


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

vA: =(max(match(Filter,'A')) and GetSelectedCount(Filter))

vB: =(max(match(Filter,'B')) and GetSelectedCount(Filter))

etc


talk is cheap, supply exceeds demand
rubenmarin

Hi Nishat, you can create the 5 variables and add a trigger for OnSelect and/or OnChange for the Filter field.

this trigger has 5 'set variable' actions, one for each variable, lokking if Filter contains the value and set 1 or 0, accordly

ie:

Variable: vA

Value: =If(Index(Concat(Filter), 'A'), 1, 0) <-- Stores 1 if 'A' is included in the possible values for filter.

Take care if some values of filter are substrings of others, if this happens you'll need to add something more to identify each value

Anonymous
Not applicable
Author

vA= substringcount( getfieldselectionst(Filter),'A')

the other variables according

Not applicable
Author

Hi,

Similarly is there anyway to set a variable vSingleTypeSelected to 1 when a distinct value in the Type field is clicked?

Thanks

Tom