Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for 
Search instead for 
Did you mean: 
CNH_1978
Contributor II
Contributor II

Button with set variable value action

Hi, 

I have a question about setting a variable value with a button.

I have set up a variable (vTest) and given it a value of 10 (as below)..

Capture.PNG

Then i have created a button with an action of 'Set Variable Value' and entered a value of 999..

Capture2.PNG

I have also added a text box to show the value of the variable vTest and a variable input box to change the variable value.

Capture3.PNG

So as you can see, the variable value is 10. When i click the button the values change to 999 (as expected)..

Capture4.PNG

and when i manually change the variable using the input box, the value changes as expected in the above objects..

Capture5.PNG

BUT if i then go and look back in the variable overview section, the variable still states 10..

Capture6.PNG

Does anyone know why this is happening? is it something i'm missing. 

I know i shouldn't compare to QV but when setting a variable value using an action on a button (or other object) the physical variable value gets changed in the overview screen. 

I need a way for a user to clear out the variable value completely so it's blank with a button. 

I know i can set the variable to be blank in the script, but that involves a reload which isn't an option.

Does anyone have any ideas?

3 Replies
NitinK7
Specialist
Specialist

Hi,

Set variable name in single quote like 'vName'.

see below screenshot.  This will be working fine.

variable.JPG

mfarsln
Creator II
Creator II

Hi,

AFAIK, it shows the definiton of the variable, not current value. Although 'Variables' section shows 10, your value still has the value that you typed/selected. Variables section always shows the first value you entered when creating the variable. 

hphaidemann
Contributor II
Contributor II

The point is that, if you refresh the browser the input value is not stored in the variable. In QlikView, if you save the app, the app stores the new content for that variable.

In Qlik Sense, the new value only works for the app if you keep it open.

I am having the same problem and I still didn't find a way to change and save the variable content from the interface.

If you find something using default QS objects, please, let me know.

Thanks.