In QlikView, variables created in the backend (script) are automatically available for use in the frontend. The problem with this is, that you don’t always need all the script variables in the frontend. These can be variables used for things like loop counters and variables for storing table names and files locations, etc.If you have a very complicated script, with many variables, this really makes a mess of your variables in the frontend.
There are a few simple things to remember when building a QlikView document, so that you can remove the script variables easily.
1. Prefix your script variables and your frontend variables differently, so that you can identify them. I like to prefix my script variables with “x” and my frontend variables with “v”. If there are any script variables that I will need in the frontend, I prefix them with “v” in the script.
2. You need to delete your script variables by going to Settings | Variable Overview or
Ctrl-Alt-V, selecting all the script variables and clicking “Remove”.
3. You need to set all the variables equal to NULL at the end of the script as follows:
LET xSomeCounterVaraible=; this only works when the variable did not exist when the script started loading – hence step 2.
Now when you reload the script, the variables will be created during the load of the script and will then be removed once the script has finished reloading.
When you exit a script pre-maturely and the script did not get to NULL the variables, and you save the document, all the variables will be back in the frontend again. You will then need to go to the Variables Overview and delete all the script variables, before your next full reload.