Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
johnpaul
Partner - Creator
Partner - Creator

inconsistent variable behaviour

Hi Experts,

This is an interesting one that I can't work out.

I add a new variable, lets call it ShowSettings and I set it to 1.

Set ShowSettings = 1;

Then I add a button and I add an action:

CapturFiles_46.png

When I click on the button, nothing happens.

If I add the following code:

CapturFiles_48.png

still nothing happens.

If I add:

=num(ShowSettings +1)

I get 1111 etc each time I add it.

The interesting thing is that it is very inconsistent.

On some documents it works fine; for example, if I create a brand new document, then it will work OK.

I have tried it on the V11 IR, SR1 and SR2 versions. IR is the worse.

It is almost like the variable is being cast as a character.

I can work around it, but it is a pain, as I wanted to copy a whole lot of sheets which use that logic and work OK in another document. I suppose I could start again and copy everything over..

2 Replies
swuehl
MVP
MVP

I believe you should state the variable name under 'Variable' in your action dialog without the equal sign, just

ShowSettings

'Value' with expression

=ShowSettings *-1

should work then.

johnpaul
Partner - Creator
Partner - Creator
Author

Hey swuehl,

you are 100% right.

I normally use the =variable to ensure that I don't mis type it.

Then I remove the = sign.

When I took the screenshot, it was before I removed the = sign.

What happens is the following when the action fires:

when it first is multiplied 1 * -1 the result is -0, then the second time it is 0 and it remains at 0