Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a variable that contains an expression to calculate a date. In the background of this screenshot you can see a text box that correctly evaluates the expression as a date.
But when I use the same variable in a load script, QlikView insists on inserting the expression itself into the script, not the evaluated results. What gives? The reference manual says that if the first character of a variable value is "=", QlikView will try to evaluate the value as a formula and insert the result.
I found that the script will evaluate the variable only if I remove the "=", but sheet objects evaluate the variable only if I include the "=" -- the exact opposite.
Am I missing something here?
Hi,
maybe you can create two versions of the same variable. One with the = and other without it.
Or you can call the variable on the sheet objects forcing a =
something like $(=variable1)
Hope it helps,
Erich
Are you using the keyword LET instead of SET? If your loadscript statement is something like LET myvar=YEARSTART(TODAY(2)-2); then QlikView will evaluate the expression to the right of the equal sign and put the result into the variable. If you write the same statement using SET then QlikView will store the expression text in the variable without evaluating it.
I understand the LET/SET distinction. However, the variable already contains the expression text starting with "=", so I thought the load script would replace the variable with the evaluated result. Instead, it inserts the expression itself into the script, which causes a syntax error.
I ended up coding LET vARCHIVE_DATE=YEARSTART(TODAY(2)-2); and then placing $(vARCHIVE_DATE) into the code later.
But this is not consistent with the way the reference manual says variables should operate.
Thanks for everyone's feedback.
James