Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Is there a way to do the same thing than the following macro by the very beginning of the loading script?
Sub cleanVariables
Set VariableCollection = ActiveDocument.GetVariableDescriptions
For i = 0 to VariableCollection.Count - 1
Set tempVar = VariableCollection.Item(i)
tempVarName = tempVar.Name
ActiveDocument.RemoveVariable tempVarName
Next
End sub
The idea is to flush the application from every variable when the reload button is engaged.
Thanks in advance.
VarName =;
or
VarName = null();
Regards,
Ricardo
Hi Ricardo,
this will flush a known variable, but will not do the same thing than the macro.
The macro is looking for any existing variable in the document then remove it.
Hi,
I use the commands above to delete the temp variables in loading script (QV 11.0 SR2). The values of the variables will be deleted, but the empty variables stay in the Variable Overview.
This is a datamart and the variables will be not used in frontend.
How can I delete the variables in Variable Overview with loading script?
Thanks
Hi
If the following conditions are met, the variable will not persist into the front end:
Hope that helps
Jonathan
ok, if the script runs some times variables exist already. This sentence was helpfull:
"The variable does not exist before the reload (in other words it is created by the load script)"
Thanks
In any case, you need to (eg) set vVar=;
this leads me to another possible situation: suppose you create the variable declaring it on the script but forget to assign the empty value and after loading and using the frontend, you save the document, storing the variable into it. In this case, I think, whether you insert the [ set vVar=; ] statement in the script, you ought to delete it from the document using the Document Property window.
You are correct Martin. You created variable in the script and refresh the app. So you can see the the variable on the Variable window (Ctrl+Alt+v). If you delete the variable from application, you need to assign null or nothing in the script. If the variables already on UI, you shouldd have to delete from UI as well.
Here is my script that dont creates variables in Application after script ends. Try it in your case.
Now = Now();
ReloadTime = ReloadTime();
DocumentPath = DocumentPath();
DocumentTitle = DocumentTitle();
LOAD * INLINE [
AppPath, AppReloadTime, AppDocumentPath, AppDocumentName
$(QvWorkPath), $(Now), $(ReloadTime), $(DocumentPath), $(DocumentTitle)];
Now = Null();
ReloadTime = Null();
DocumentPath = Null();
DocumentTitle = Null();