Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why DOES this work?

Hello.  I'm still trying to understand the "under the hood" behavior of QlikView so it would be great if someone could please explain to me why the following Works:

Under variable settings I define two variables, lets say   vDate1 = 'xxxx' and  vDate2= 'yyyy'.

I want to create a button that, when clicked, causes the contents of the two variables to be swapped, such that vDate1='yyyy' and vDate2='xxxx'.

The engineer in me says that in order to do this, I need an intermediate variable so that I can define actions to do something like:

Action1: set vDateTmp = vDate1

Action2: set vDate1 =vDate2

Action3: set vDate2 = vDateTmp

However I've discovered that I can create a button with only two actions as follows:

Action1: Set vDate1 = vDate2

Action2: set vDate2 = vDate1

And it works!   My question is.. why??

Thanks,

Steve

1 Solution

Accepted Solutions
flipside
Partner - Specialist II
Partner - Specialist II

I'd say that when you click the button the QV engine first replaces the variables with the actual values, then executes the "set" actions with the values in place of the variables, rather than running the actions sequentially.

flipside

View solution in original post

4 Replies
flipside
Partner - Specialist II
Partner - Specialist II

I'd say that when you click the button the QV engine first replaces the variables with the actual values, then executes the "set" actions with the values in place of the variables, rather than running the actions sequentially.

flipside

Not applicable
Author

Yeah that makes sense (and is what I suspected) but I wanted to be sure. Thanks.

advait_thakur
Creator III
Creator III

Hello Steve,

I would like to make a statement here.. very true what you are thinking. Lets give a thought from qlikview prospects.

Qlikview engine determines the "Click", the moment engine determines the value, variable will set the value by swapping the true value. The "Click" event of your Actions2 will be involved in you button directly.

Now you can visualize the actions that event took place.

I hope you understand the mechanism of the qlikview for the concern you raised,

Thanks

Advait

Join the official Qlik Enthusiast's page here
https://www.linkedin.com/groups/6513382/
flipside
Partner - Specialist II
Partner - Specialist II

You can test this theory by creating 3x variables ...

Value1 = 5

Value2 = 8

ValueTotal = {nothing}

Set a button to swap Value1 to Value2, Value2 to Value1 and ValueTotal to (2xValue1) + Value2.  Your end result should show ...

Value1 = 8

Value2 = 5

ValueTotal = 18

.. proving ValueTotal is calculated before the swap.

flipside