Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
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
Highlighted
MVP & Luminary
MVP & Luminary

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
Highlighted
MVP & Luminary
MVP & Luminary

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

Highlighted

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

Highlighted
Anonymous
Not applicable

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

the other variables according

Highlighted
Not applicable

Hi,

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

Thanks

Tom