Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ken4runner
Creator
Creator

How to set a variable value with a button click (dashboard bundle - navigation button)

I have a Qlik Sense app, Feb 2019 P3, and I have created a variable in the sheet view, using the variable button in the bottom left corner of the sheet view. I have a button, created from dashboard bundle, button for navigation. For the button action, I have selected Set variable value, and picked my variable and given it a value . My understanding is that when the button is clicked, the variable should be set to the value defined in the button properties.   I created a text box to display the variable value. I can see that the default value of the variable is there, but when the button is clicked the value should change to the new value defined in the button properties. But it does not work and the variable value is not updated or changed.

What am I doing wrong and how can I get the button to properly set the value of the variable? 

I can upload a sample app but this is a very simple scenario and it can be done in any app and no special data is required, I just cannot seem to get this to work

Labels (1)
3 Replies
treysmithdev
Partner Ambassador
Partner Ambassador

If this doesn't, help it might be worth uploading an image of your settings.

 

variable-buttonvariable-button

Blog: WhereClause   Twitter: @treysmithdev
ken4runner
Creator
Creator
Author

thank you, I finally figured out that the variable name must be in single quotes in the Set variable value properties, which I do not understand but that is the only way it works. If you insert the variable using the expression editor wizard, the syntax is wrong and it will not work.

='variablename'       this works

=variablename          this does NOT work
(and if you insert the variable in the expression using the expression editor wizard, this is what you get and it will not work)

The value entry for the set variable value must be part of an if statement, at least in the version I am using. the example shown in the youtube video, https://www.youtube.com/watch?v=m6DM-T8zywE does not work for me. it only works  for me when an If statement is used in the expression. and the variable must be inside $() to be evaluated in the expression.

example value expression: 

=If($(variablename)=1,1,0)

UncleRiotous
Creator
Creator

Thanks  Ken, exactly the same problem has been bugging us for the last half an hour. Ridiculous implementation, this really shouldn't be necessary.