Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I set a variable to the value of a selection so it persists when I change the selection?

I have a button that sets a variable to the selected entry in a listbox:

Variable:  vSelectionA

Value:  ='GetFieldSelections(field)'

I only want the variable to change when I select the button, but it changes when the listbox selection changes, without touching the button - this seems to work like a SET script statement whereas I want it to be like the LET statement and return the evaluated string.  I tried the Evaluate() function but this is not available for a button.

I want to make two selections, one at a time, remembering them in different variables, vSelectionA and vSelectionB.

3 Replies
m_woolf
Master II
Master II

Remove the apostrophes:

  =GetFieldSelections(field)

sunny_talwar

Have you tried using triggers here? May be you want to save the value in the variable on a button click.

Not applicable
Author

Without the quotes I get "Garbage after ...." - it works with the quotes.  The problem is that the result changes with the selections not the button.

I found the solution was to omit the dollar sign expansion and simply to use

=field

I have yet to find a comprehensive explanation of the syntax - when you need quotes, when you need $(), when you need =.