Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I am trying to define a variable with sum involving aggr function in the data load editor. But the aggregation inside the aggr is evaluated. I just want store the expression with out being evaluated as the expression is related the selections made in the front end dashboard.
Ex: I want to store this expr = 'sum(aggr(1, $(=concat('[' & %Dimension & ']', ',' ))))' in a variable in data load editor, but the concat function is evaluated while reloading the dashboard itself and concat function returns null.
Request to provide some suggestions to resolve this issue.
Thanks,
Vidya
The issue is the $(. You have to break them up and & concat them back together:
Let myvar = 'sum(aggr(1, $' & '(=concat(''['' & %Dimension & '']'', '','' ))))';
As you can see in my example, you will need to specify two single quotes in the inner quotes to escape those.
Another approach is to use a proxy char like @ and fix with replace:
Let myvar = replace('sum(aggr(1, @(=concat(''['' & %Dimension & '']'', '','' ))))', '@', '$');
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
are you definined the variable using LET or SET; you want to use SET to store that expression as a string.
SET assigns the value to the variable without evaluation, as a string, the LET first evaluates the expression at the right part of the "=" sign, then stores the value.
Thank you for the reply.
I am using SET only, this particular expression $(=concat('[' & %Dimension & ']', ',' )) inside the aggr function is getting evaluated due to = and $ expansion.
I tried to define variable for this ($(=concat('[' & %Dimension & ']', ',' ))) as well and use it in the main variable, but still it gets evaluated.
The issue is the $(. You have to break them up and & concat them back together:
Let myvar = 'sum(aggr(1, $' & '(=concat(''['' & %Dimension & '']'', '','' ))))';
As you can see in my example, you will need to specify two single quotes in the inner quotes to escape those.
Another approach is to use a proxy char like @ and fix with replace:
Let myvar = replace('sum(aggr(1, @(=concat(''['' & %Dimension & '']'', '','' ))))', '@', '$');
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Thank you Rob. The Replace approach worked in my case.
Vidya