Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable in overview but returns null in dollar sign expansion

I am loading a table of variables with below. The number of rows is correct, and some variables work. All are seen in the variable overview with correct value. However, a few return null with dollar sign expansion in a text box.

Variables:
LOAD
Variable,
     Expression
    
FROM $(vQVDPath)VariablesQVD.qvd(qvd);

Let Rows = NoOfRows('Variables');
For i = 0 to NoOfRows('Variables')-1
Let vVariable=peek('Variable',$(i),'Variables');
Let '$(vVariable)' = peek('Expression',$(i),'Variables');
next i;
1 Solution

Accepted Solutions
Not applicable
Author

I figured out the issue. When loading a variable from a spreadsheet and the value is text you have to use single quotes as well as the dollar sign expansion. ( ='$(vTabName') )

View solution in original post

8 Replies
mgaseron
Contributor II
Contributor II

What looks to be causing the issue is the single quote around when defining $(vVariable) to its associated expression calculation. Remove them. Try the below:

LET Rows = NoOfRows('Variables');

FOR i=0 to $(Rows)-1

     LET vVariable = peek('Variable',$(i),'Variables');

     LET $(vVariable) = peek('Expression',$(i),'Variables');

NEXT

Gysbert_Wassenaar

Then the expressions in some of the variables will evaluate to null when you dollar-expand them in the context you use them in. Please post a qlikview document that demonstrates the problem.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hiii Trey,

Use Set Statement in space of Let Statement If you want to use it in Text Box with Dollar Sign Exoansion.

Thanks & Regards

Prince Anand

Not applicable
Author

Have you removed = from before all expressions in Expression field in variables qvd file?

mgaseron
Contributor II
Contributor II

I agree with this statement...when defining the calculations in the Expression field, do not use the equal sign.

ToniKautto
Employee
Employee

The LET based variable means that the variable is evaluated during script reload. If you instead declared the variable as text it will not be evaluated during the reload. I think you could pull it of by using a SET declaration, alternatively by using Text().

SET '$(vVariable)' = $(=peek('Expression',$(i),'Variables'));

LET '$(vVariable)' = Text(peek('Expression',$(i),'Variables'));


Later when you want to refer the variable you simply dollar expand it into your expression(s).

Not applicable
Author

I figured out the issue. When loading a variable from a spreadsheet and the value is text you have to use single quotes as well as the dollar sign expansion. ( ='$(vTabName') )

ToniKautto
Employee
Employee

Good to hear you got it to work. Please remember to mark helpful and correct answers, to indicate that no more action is required on the thread and to give your fellow community member some thanks for helping out.