Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to set a varible from code that results in a YTD-like value (in the attached example). I am able to create an expression in a table to get the result. I can also set the variable in the variablescreen and use that to display the desired value, but because of reasons of reusability and the number of variables I need, I want to set the variable in code. This results in an error.
I have tried a lot, but possibly not everything. Maybe some of you guys might be able to come up with a suitable solution.
Kind regards, vBeijnen
It is a difficult matter ... cause are special characters. In most cases it is enough to replace single quotes with double quotes, but here it seems it is the $ sign - see here http://community.qlik.com/message/337484#337484 and also the attachment.
set vFromScript = 'Count({1<Date={"<=#(=max(Date))"}>} Label)';
let vFromScript = replace('$(vFromScript)', '#', chr(36));
- Marcus
It is a difficult matter ... cause are special characters. In most cases it is enough to replace single quotes with double quotes, but here it seems it is the $ sign - see here http://community.qlik.com/message/337484#337484 and also the attachment.
set vFromScript = 'Count({1<Date={"<=#(=max(Date))"}>} Label)';
let vFromScript = replace('$(vFromScript)', '#', chr(36));
- Marcus
Hi vBeijnein
it is beacause of the $ sign in the string
you have to split up your string like
SET v = first_part_string & chr(36) & second_part_string : chr(36) for $ sign
Idem ifyou use simple/double cotes
best regards
chris
Thank you kindly, Marcus!
Thanks, Christianj, Marcus beat you to it... this time.