Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
Hope you are doing great and I will appreciate it if you can help me with this problem. I created a variable in a sheet named as vBetweenRolling5 and defined as
{"$(= '>=' & FirstDayMonthRolling5 & '<=' & LastDayMonthRolling5)"}
Everything was working as it suppose to; however, I wanted to transfer all my variables to data load level. Therefore, I created the load script as
LET vBetweenRolling5 = '{"$(= ' & CHR(39) & '>=' & CHR(39) & ' & FirstDayMonthRolling5 & '& CHR(39) & '<=' & CHR(39) & ' & LastDayMonthRolling5)"}';
However, the variable was created in debug as
{""}
Please see the screenshot:
Any suggestions?
Thanks a million in advance!
cleveranjos, got it! However, my confusion was about using & character as the dummy. Because I have other & characters in the script; therefore, your solution was fixing all of it. I changed the code as
LET vBetweenRolling5 = '{"%(= '&CHR(39)&'>='&CHR(39)&' & FirstDayMonthRolling5 & '&CHR(39)&'<='&CHR(39)&' & LastDayMonthRolling5)"}';
LET vBetweenRolling5 = REPLACE(vBetweenRolling5 ,'%','$');
So using % instead of & character fixed the issue. Thank you very much for this answer!
Try with this, it´s a known issue
LET vBetweenRolling5 = '{"&(= ' & CHR(39) & '>=' & CHR(39) & ' & FirstDayMonthRolling5 & '& CHR(39) & '<=' & CHR(39) & ' & LastDayMonthRolling5)"}';
Let vBetweenRolling5 = Replace(vBetweenRolling5 ,'&','$')
cleveranjos, thank you for your answer. It looks like it works in debugger. I will check and try it in the real app ASAP. However, can you please explain how the replace function fixes this issue?
The main reason is when Qlik parses the $ into your Let command it will try to evaluate you expression at that specific time.
Using another char ( & for example ) and replacing it later, the parsers does not 'touch' the string
cleveranjos, got it! However, my confusion was about using & character as the dummy. Because I have other & characters in the script; therefore, your solution was fixing all of it. I changed the code as
LET vBetweenRolling5 = '{"%(= '&CHR(39)&'>='&CHR(39)&' & FirstDayMonthRolling5 & '&CHR(39)&'<='&CHR(39)&' & LastDayMonthRolling5)"}';
LET vBetweenRolling5 = REPLACE(vBetweenRolling5 ,'%','$');
So using % instead of & character fixed the issue. Thank you very much for this answer!
good to read that
Would you mind markin my answer as "helpful"?
My pleasure!