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: 
Anonymous
Not applicable

match values within a variable

Hello,

I'm wondering how I can place multiple text values within a variable and, if a selected dimension value matches one of the values in the variable, activate a button.

The variable contains comma separated values and I'm trying to say that when a selected value in a dimension = a value in the variable, show 1, 0.

Something like this:

if(match(Getfieldselections(Dimension),Variable),1,0)

My variable is set like this in the script:

Set Variable = 'Text1','Text2','Text3';

Any suggestions?

1 Solution

Accepted Solutions
sunny_talwar

Or this if the button should be hidden when not selection in Dimension is made

Max(Aggr(If(SubStringCount(Variable, Dimension) >= 1, 1, 0), Dimension)) and GetSelectedCount(Dimension) > 0

View solution in original post

9 Replies
sunny_talwar

Try this:

Max(Aggr(If(SubStringCount(Variable, Dimension) >= 1, 1, 0), Dimension))

sunny_talwar

Sample attached

sunny_talwar

Or this if the button should be hidden when not selection in Dimension is made

Max(Aggr(If(SubStringCount(Variable, Dimension) >= 1, 1, 0), Dimension)) and GetSelectedCount(Dimension) > 0

vishsaggi
Champion III
Champion III

Sunny, why we need Max(Aggr()) cant we just use

like in layout conditional

= vVar = If(SubStringCount(Variable, Dimension) >= 1, 1, 0)     ??

sunny_talwar

If this need to work only based on a single selection, then without Max and Aggr() will work... but in case we need this to work based on multiple selection, then without Max and Aggr() it will not work....

vishsaggi
Champion III
Champion III

Ah, Got it. Thanks for that.

Anonymous
Not applicable
Author

Thank you both for the responses!  I only needed it to be based on a single selection and it's working without the max and aggr.

vishsaggi
Champion III
Champion III

David, by mistake you have made my response as correct. I did not give that solution, i got that from Sunny. I have just asked that question to him.

vishsaggi
Champion III
Champion III

No harm, Even though you use them, it still works...So, i feel i should not be credited for this as i just copied from his expr.