Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there a way in QV to drop/hide temporarily used variables in a script ?
When reloading QV files, we are using quite some temporary variables (current date, number of years to reload, start year, QVD - folderpaths, ...) that are of no use for QV professionals and/or end users
Is there a way to drop (selected number of) variables at the end of your reload script or at least hide them one way or another for the professional / end users ? The professional user will often make use of variables himself (we encourage this instead of hard coded values), but the variable list tends to become quite long with variables that are only needed during the reload stage. Quite some variables are set at the beginning of the reload script using one or more includes (create once / use everywhere) so it would be nice if we could run an include at the end that removes the 'unnecessary' variables from the QV file.
If that part of the script isn't reached, then the code won't be triggered.
If I try to perform this, I end up with all the variables still in my QV file but with a value 'Nothing' or 'Null()'.
That is not exactly what I want. In the beginning of each QV file I add all the workpaths (QVD, QVW, ...) by means of variables. At the end of the script, I do not need these variables anymore and I would like to remove them. They are of no value for the end user.
The SET Variable =; syntax only works with variables crated within that load script, I understand.
The proposed method should work, e.g. when using these statements in a just created document script:
Let x = 10;
Let y = 20;
Let z = x+y;
Let x= NULL();
Let y= NULL();
Only variable z should get to the UI, and should hold 30. x and y are deleted at the end of the script.
AFAIK, this deletion only works if the variable was newly created in the script, if it already passed to the UI once, a following script run won't completely delete the variable, you'll need to delete it in the variable overview once, then subsequent script runs should create / delete it.
I tried the following :
Through a general include that is inserted in the beginning of the script (of all QV files), a number of paths are assigned to a variable :
LET salesdir = 'S:\In Production\QVD\Sales\';
LET accountingdir = 'S:\.....';
At the end of the script, I now built an include containing the following code :
LET salesdir = Null();
LET accountingdir = Null();
Just before reloading the file, I removed these variables from the overview and saved the QV file.
After the reload, I checked the variable overview and all variables are still there showing Null() as a value.
In my case, the variables are not removed. Running QV 11 SR2
Can't reproduce this here on QV11.20 SR3
Attached my test files.
Hello Xavier,
Please be careful, the LET and the SET instructions do not react the same way when assigning values to a variable. The LET statement forces the immediate evaluation of the expression following the "=" sign, whereas the SET statement defers the evaluation to when the variable is actually used.
So, if you write
LET a = Null();
The variable will be immediately be assigned the a null value, and if it did not already exist before the execution of your script, it shall be removed from the memory.
If you write
SET a = Null();
The variable will be assigned the expression "Null()" and will be kept in memory for later use.
Hope this helps, regards,
Philippe