Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
pedrohenriqueperna
Creator III
Creator III

Delay Dollar Sign Expand in User Defined Function

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.

Labels (4)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

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...

View solution in original post

3 Replies
Vegar
MVP
MVP

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...

pedrohenriqueperna
Creator III
Creator III
Author

Hi, thanks for the reply

 

Although far from practical, it works, thanks!!

pedrohenriqueperna
Creator III
Creator III
Author

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));