Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

How do I clear all QlikSense variables?

It seems QlikSense variables are stored even after the variable definition is deleted, which can cause unexpected results. It can make things very difficult to debug when there is no variable defined in the load script, but it is used (and has a value). How can I clear ALL variables at the start of my load script (without knowing variable names)?

Thanks

Tags (1)
11 Replies

Re: How do I clear all QlikSense variables?

I can't reproduce the described behavior. When I delete a variable from the sheet editor, it o longer ha a value in the script. I am using Sense desktop 2.2.3. What version are you using? Can you post a qvf that demonstrates the problem?

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

phaneendra_kunc
Valued Contributor III

Re: How do I clear all QlikSense variables?

It is a odd behavior, and haven't see this in my versions 2.0.1, 2.2.3, 2.2.4 & 3.0.

Try using this extension and export all variables and copy & paste them back to load script and modify them something like...

Let vCurrMonth ='';

Let vPrevMonth ='';

Qlik Branch

Not applicable

Re: How do I clear all QlikSense variables?

I think the variable will no longer exist when you reload the it. Hope it helps!

Not applicable

Re: How do I clear all QlikSense variables?

We are using 2.2.4. My understanding is that this is known, accepted behavior. Let's say I have these two lines:

   LET vTest = 3;

   vTest = $(vTest) * 2;

I have a sheet with a KPI displaying $(vTest). I hit Load, and it shows 6. I can hit Load a hundred times, and it will always display 6. Now I make this change:

  LET vTestTypo = 3;

  vTest = $(vTest) * 2;

Now it displays 12. Wait, what? Let me trying loading again, without changing anything. Now it displays 24. Load again, it shows 48. I'm expecting 6. The reason is that QlikSense saves variables with their most recent value, regardless of whether they are in the load script. After the initial run, when the typo is introduced, it remembers vTest was 6, so it doubles it (then again, and again).

This is not the only downside of this "variables persist" design, but it's the easiest to demonstrate. What I would like to do it clear out ALL variables at the start of my load script, delete them or at least set them to NULL. According to my Googling, something similar can be done in QlikView‌, but it requires functions/macros that QlikSense does not have. Is there a way to get a list of all QlikSense variables in the load script, and clear out their values?

Not applicable

Re: How do I clear all QlikSense variables?

Hi Michael!

I'm having also troubles with this behaviour.

Did you find a solution for it?

I'm in QS desktop 3.1

Cheers!

Azu

Not applicable

Re: How do I clear all QlikSense variables?

No solution yet. I have found a number of posts confirming the behavior, but nothing with any practical advice.

xufei123
Valued Contributor

Re: How do I clear all QlikSense variables?

In my case I have duplicated lines in the variable overview in Sense application (I have no idea how could this happen):

The variables (defined in script) cannot be edited / deleted in the front. To remove them, you need to go to script and do "set variable=;" (see Deleting a variable ‒ Qlik Sense in the official help page), reload, and then edit / delete the variable in the front.

In my case, I have to reload four times, each time one of the duplicated variable became editable then I deleted one.

Please note this works in Sense desktop 10.3.4. When I tried the same steps first in a Sense 3.1 server, it did not work (Every time I reload the script, one new editable variable appears. I can only delete this new created one. I still cannot do anything to the existing duplicated ones).

Just hope this can provide some help.

Cheers.

Fei

gandalfgray
Valued Contributor

Re: How do I clear all QlikSense variables?

Hey Fei!

Do you have a multi node setup?

We have the same weird issue.

We are on 3.0 and had a multi node setup, but started to get lots of problems, which Qlik claims is due to sync problems between the nodes.

We have now shut down all nodes except the central node but the variable duplicates are still there.

xufei123
Valued Contributor

Re: How do I clear all QlikSense variables?

No Goran. I only set up a central node for test purpose.

Community Browser