Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dropping temporary variables after reload

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.

16 Replies
skn
Employee
Employee

Hi,

a simple

set vVariable = ;

would do the job.

Not applicable
Author

That is not exactly what I mean.

It's not that my professional / end users may not see the contents of the variable, I mean the variable itself.

The include's contain variables for database connections, network paths to store QVD files, ...

All these variables are now stored within the several QV applications, while they are only of use during the reload sessions itself.

I was thinking of a way drop (or hide) them at the end of the reload (compare it with going to the variable overview and deleting them manually).

Miguel_Angel_Baeyens

Hello,

Depending on how are you loading your document, I'd give a try to create a macro with the code

Sub CleanUp ActiveDocument.RemoveVariable "vVar"End Sub


And trigger it in the Settings menu, Document Properties, Triggers, OnPostReload.

Hope that helps.

danielrozental
Master II
Master II

If you do it in the "OnPostReload" event, it won't work with publisher.

Not applicable
Author

In the meantime I am using the Publisher so guess the suggested solution will not work. Any other ideas ?

chrisbrain
Partner - Specialist II
Partner - Specialist II

Also interested in an answer to this. Sometimes we might end up storing credentials in QlikView variables during the load script cycle. Is there a way to ensure these are blanked after the reload has run (even if the reload fails for some reason?)

beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

At the end of the script you can drop the variables like

Set vVariable = ;

or

Set vVariable = Null();

It will remove the variables.

chrisbrain
Partner - Specialist II
Partner - Specialist II

Does this still work if there is an error during the reload and this part of the script is never reached?

beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense
flipside
Partner - Specialist II
Partner - Specialist II

You can also loop over a variable list and set them to Nothing at the end of the script ...

for each v in 'a','b','c','d','e','v'
LET '$(v)' = Nothing;
next v;

... but this won't run if there's been a failure. In that case you would need to wrap error handling around all or parts of the code and then test for failures to determine if variables need cleaning up.

flipside