Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
burak_ersoy
Contributor III
Contributor III

Variables in Load Editor and CHR(39)

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:

Capture.PNG

Any suggestions?

Thanks a million in advance!

1 Solution

Accepted Solutions
burak_ersoy
Contributor III
Contributor III
Author

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!

View solution in original post

6 Replies
Clever_Anjos
Employee
Employee

Try with this, it´s a known issue

LET vBetweenRolling5 = '{"&(= ' & CHR(39) & '>=' & CHR(39) & ' & FirstDayMonthRolling5 & '& CHR(39) & '<=' & CHR(39) & ' & LastDayMonthRolling5)"}'; 

Let vBetweenRolling5  = Replace(vBetweenRolling5 ,'&','$')

burak_ersoy
Contributor III
Contributor III
Author

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?

Clever_Anjos
Employee
Employee

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

burak_ersoy
Contributor III
Contributor III
Author

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!

Clever_Anjos
Employee
Employee

good to read that

Would you mind markin my answer as "helpful"?

burak_ersoy
Contributor III
Contributor III
Author

My pleasure!