Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trouble referencing variables in set analysis within load script variable

Hey All,

I recently asked a similar question and got a great answer, but this one is a little more complex.

I want to define a lot of variables in the load script because I need to be able to easily transfer them into other applications I am working on.

This is the definition of some variables I will reference. These all work as intended.

onlyexample.png

This set analysis works in a text box

=Only({1<SalesPerson={'$(vNameRetrieval)'}>*<myDisplayQtr={'$(vDisplayQTR)'}>}LeagueOfLeagues.RankPercentage)

The only way I can get variables to work in set theory is by using  {"$(variablehere )"} wrapped around them.

Here is my problem

If I write this in load script

loadscript.png

It shows variable contents where variable names should be in variable overview:

variablecontents.png

Which  returns - because Only(Only()) never seems to work. It needs to come out with the inner variable names there instead of their contents.

I have tried lots of different combinations of "s and 's and also tried removing $() from around the variables in the load script but then the set analysis refuses to work because it no longer recognises my input as a variable name:

attempts.png

Any suggestions?

Thanks!

1 Reply
Gysbert_Wassenaar

The script will also try to evaluate $(...) constructs. Since set analysis doesn't work in the script you get things that don't work. The workaround goes like this:

SET vMyVar =Only({1<SalesPerson={'@(vNameRetrieval)'}>*<myDisplayQtr={'@(vDisplayQTR)'}>}LeagueOfLeagues.RankPercentage);

LET vMyVar =replace('$(vMyVar)','@','$');


talk is cheap, supply exceeds demand