Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mapuna
Partner - Contributor III
Partner - Contributor III

Part of expression($ sign expansion) doesnot come up while assigning that Qlik expression into variable ( expression and variables are in excel table)

Consider an excel sheet as below, contains 2 columns one for variable name and other for variable expression.

AnupamRaj_0-1670232874654.png

This has to be loaded into qlik and these variables vA,vB,vC has to be created. I have done this using for loop as follows:

vars:
LOAD
VarName,
VarExpression
FROM [lib://new path/variables.xlsx]
(ooxml, embedded labels, table is Sheet1);

for i=0 to NoOfRows('vars')-1;
vVar_name=peek('VarName',$(i),'vars');
vVar_expression=peek('VarExpression',$(i),'vars');

let $(vVar_name)='$(vVar_expression)';
next i;

exit script;

The problem is in the vB variable, within set analysis $(=max(year)) has been usedAnupamRaj_0-1670232874654.png

This wont come into variable, just $<Year={}> with empty { } comes up. How to fix this?

AnupamRaj_1-1670233228205.png

In the above pic it is seen, vB has $<Year={ }> instead of $<Year={$(=max(Year))}>

Note: It is properly allocated in data model.

AnupamRaj_2-1670233378675.png

Labels (3)
2 Solutions

Accepted Solutions
Mapuna
Partner - Contributor III
Partner - Contributor III
Author

set $(vVar_name)="=replace('$(vVar_expression)','~','$')";

Just realized that this should work. Won't double the amount of variables.

View solution in original post

3 Replies
Or
MVP
MVP

Mapuna
Partner - Contributor III
Partner - Contributor III
Author

Great! This method worked fine for me.

But it will just create double the amount of variables by using one variable just for replace function:

set $(vVar_name)="$(vVar_expression)";
set v$(vVar_name)final= "=replace([$(vVar_name)],'~','$')";

Is there any way to get around this? Just curious. Doubling the number of variable might effect performance. That is my concern.

Mapuna
Partner - Contributor III
Partner - Contributor III
Author

set $(vVar_name)="=replace('$(vVar_expression)','~','$')";

Just realized that this should work. Won't double the amount of variables.