I am Setting some variables in the script of my qlikview application. Later on I try to reuse one of the previous variables but qlikview is giving me an error.
SET vCurrentMonth = "=CAL.MONTH";
SET vMonthCounter = "SUM({<MONTH = {'$(vCurrentMonth)'}>} Counter)";
SET vMonthCounter = "SUM({<MONTH = {'" & chr(36)& "(vCurrentMonth)'}>} Counter)";
Thanks in advance
It works fine for me even without using the chr()
function. I've added =
before the sum
(i've used simple string for vCurrentMonth
and remove the =
there):
SET vMonthCounter = "=SUM({<MONTH = {'$(vCurrentMonth)'}>} Counter)";
and then using the variable in text box (like below) is giving me the correct result:
= vMonthCounter
If you still prefer the chr()
approach then some changes in the vMonthCounter
are needed to get the same result:
let vMonthCounter1 = '=SUM({ <category = {' & chr(39) & chr(36) & '(vCurrentMonth)' & chr(39) & '} >} value)';
set
is replaced with let
. let
evaluates the expression and will actually run and replace the chr()
with the symbols (btw when using set
you are not obligated to enclose the string in any quotes)
replaced the start and end quotes with single quote
the single quotes inside the set expressions are replaced with chr(39)