Qlik Sense is hardcoding a variable declared inside another variable from a script/qvs/text file
As always, I'm always immensively grateful for your invaluable help.
We are developing an application and, in order to have a robust and professional management of the information, we want to declare all of our variables from a qvs file, but Qlik Sense is hardcoding the values of a first input variable inside a second output one.
The input variable is declared as SET vVariableInput=1;
The output variable is declared as SET vVariableOutput=IF($(vVariableInput)=1,'The value of VariableInput is 1','The value of VariableInput is 2');
When we change the values of the input variable in an Input box, it doesn't change the value of the output as the input variable value was hardcoded when I executed the script. How can I stop this hardcoding from happening?
I add an image and the qvf file. The red circle indicates that the value is incorrect as it should say 'The value of the vVariableInput is 2'.
The second image shows how the value is hardcoded.
$() is resolved (substituted) at script execution time. If you want to defer resolving $(vVariableInput) to the front-end, you must either escape the "$(" with a trick like building it from a string or using replace(), or better yet, store your variable definitions in an external file and load from there. http://www.qlikfix.com/2011/09/21/storing-variables-outside-of-qlikview/