One of the things that really changed the way I developed QlikView applications, was when I learned the range of variables. You can use them to store expressions, colors, actions, labels, pretty much anything that is used in an expression box, as well as things referenced in the load script. The evolution of that was being able to store these externally and load them into the application. This helped me manage them, document them, and version them very easily. All it took is a simple for loop that basically “activates” them during the load.
There’s two things you need to do. First, load a table with with a field that contains the names of the variables and a field that contains the values of a variable. Second loop through the table and “activate” them.
LOAD * Inline [
For i = 0 to NoOfRows('Variables')-1
Let vVariable = peek('Variable',$(i),'Variables');
Let'$vVariable)' = peek('Expression',$(i),'Variables')'
Drop Table Variables;
You know have two variables in your application, which you can use using the dollar sign expansion.
I’ve went a step further and created a sub routine since I usually do this multiple times in the load, which you can find below.