Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to create defined functions to make some expressions more readable, but I can't find a workaround to not expand a $() using SET.
For instance:
SET someFunction =
(Sum(Aggr({<store= {$1}>} Revenue, store)) / Aggr(NoDistinct Only({1<key_calendar = {"$(=Floor(vToday - 1))"}, store = {$1}>} growth_idx), store));
When this function is loaded, it expands the set analysis "$(=Floor...)" and returns blank, as expected. Is there a way to delay the expansion to the front end? I've tried multiple things, like using Chr(34) for the " and Chr(36) for the $. They all come as text tho.
The best workaround for this, that i know, is to create a csv, excel file or similar containing the variable name and value. Then load that table into Qlik, and loop through each row and setting the variable name and expression using peek().
I did a quick search to find an example, you could look this comment by @rwunderlich : https://community.qlik.com/t5/App-Development/Can-I-create-a-variable-that-holds-another-variable/td...
The best workaround for this, that i know, is to create a csv, excel file or similar containing the variable name and value. Then load that table into Qlik, and loop through each row and setting the variable name and expression using peek().
I did a quick search to find an example, you could look this comment by @rwunderlich : https://community.qlik.com/t5/App-Development/Can-I-create-a-variable-that-holds-another-variable/td...
Hi, thanks for the reply
Although far from practical, it works, thanks!!
Can you give me an example based on the code I've provided?
I've tried like this, but it did not work:
SET func$ = $;
SET someFunction =
(Sum(Aggr({<store= {$1}>} Revenue, store)) / Aggr(NoDistinct Only({1<key_calendar = {"$(func$)(=Floor(vToday - 1))"}, store = {$1}>} growth_idx), store));