Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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; |
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') )
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
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.
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
Have you removed = from before all expressions in Expression field in variables qvd file?
I agree with this statement...when defining the calculations in the Expression field, do not use the equal sign.
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).
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') )
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.