Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
my problem is that any Statement using "$(...)" is evaluated within a SET Variable line.
For multiusage purposes I put a chart expression into a variable/constant. I do this already in the script like this:
SET vTestVariable = sum( { < MONTHNUM = {"$(=max(MONTH))"} > } VALUE)
QlikView tries to evaluate the "$(=max(MONTH))" part even though it's a SET Statement. The evaluation failes and throws an internal error.
Thanks for any advice
Tobias
If you can't use a subsitute character and replace it later, then another option is to put the expression in a csv file, and load the csv file, and set the variable in the script.
Say you have a csv file:
VariableName, VariableValue
vTestVariable, sum( { < MONTHNUM = {"$(=max(MONTH))"} > } VALUE)
Then load the file into a table and set the variable in the script:
LET var = peek('VariableName', 0, 'VariableTable');
LET $(var) = peek('VariableValue', 0, 'VariableTable');
Hm, that's a bit annoying..
You can work around it like this but it's not very elegant:
SET vTestVariable = sum( { < MONTHNUM = {"@(=max(MONTH))"} > } VALUE);
LET vTestVariable = replace(vTestVariable, '@', '$');
Hi.
LET vTestVariable = 'sum( { < MONTHNUM = {' & chr(36) & '(=max(MONTH))' & '} > } VALUE)';
Hi whiteline,
thanks for your suggestion. But it is not helpful for me since the original expression is very long and has many highcommas which would force me to make it very complicated.
In this case you could use Ctrl+H to replace $ with some other unique symbol as Johannes suggested.
If you can't use a subsitute character and replace it later, then another option is to put the expression in a csv file, and load the csv file, and set the variable in the script.
Say you have a csv file:
VariableName, VariableValue
vTestVariable, sum( { < MONTHNUM = {"$(=max(MONTH))"} > } VALUE)
Then load the file into a table and set the variable in the script:
LET var = peek('VariableName', 0, 'VariableTable');
LET $(var) = peek('VariableValue', 0, 'VariableTable');
In this case isn't it easier to use inline load ?
Hi vhuynh,
that is an excellent idea, because I have a excel configuration file already. And this way I will maintain my variables on a sheet of the configuration file and read them into the application looping over the lines of the variabletable.
The $() syntax will evaluate in an inline table (actually, the dollar sign expansion will occur whenever it is found in the qvs script). Since $(=) has no meaning in a load script, $(=) will expand to an error.