Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've been trying to do some research on the forums but I was unable to find something similar.
Is it possible to define a variable to be the sum of two other variables or the result of any kind of math operation between two variables?
Thanks for your help.
Define vVarSum as:
=$(vVar1)+$(vVar2)
Hi,
From the script you can have something like this
LET vSumTest_1 = 2;
LET vSumTest_2 = 10;
LET vFinal_Sum = vSumTest_1 + vSumTest_2;
Variables can reference each other just like cells in a spreadsheet application can reference each other. QlikView will parse and recalculate all dependent variables for every recalculation which is done - usually at every click or selection or change of selections.
If variable v1 has the value 45 and v2 has the value 56 nd v3 has the value (expression) =v1+v2
Then the variable v3 when it is used in any kind of expression will return 101. I think you can reference variables in any number of levels and it will recalculate correctly - just like a modern spreadsheet - no big deal.
The $-sign expansion is needed when you need to force an evaluation - but many Qlik developers use it more than needed when a simple direct reference to the variable is sufficient.
Thanks everyone for your help.
Petter, great explanation. Thanks for your time.