QlikTip #9: Deleting variables via user-interface, within the load-script or by using macros (translated)

There are three different options for deleting variables in QlikView:

  • Deleting using the “Variable Overview”
  • Deleting within the load-script
  • Deleting using macros

Option 1: Deleting using the “Variable Overview”

For deleting a variable using the “Variable Overview” within the windows client just follow the steps below:

  1. Call the “Variable Overview” dialog (Menu => Settings => Variable Overview or Ctrl + Alt + V)
  2. then select the variable you would like to delete
  3. and press the button Delete

Delete a variable from the user interface

So far so good and not new to you, but how can we delete a variable within a load-script?

Option 2: Deleting within the load-script

Variables can be deleted/removed within a load-script as follows:

// the name of the variable is vVariable
// first option for deleting variables within the load-script
SET vVariable = ;

//second option for deleting variables within the load-script
LET vVariable = null();

Note: these two options do only work under the following conditions:

  • A variable must not “survive” a load-script (exist after a load-script has finished)
  • the two possibilities shown above do only work for variables which have been first created within the current load-script.
  • If a variables has once “survived” a script-load, you have to use again option 1 (Variable Overview) to delete a variable

Option 3: Deleting a variable using a macro

Last but not least it should be mentioned that you can also delete variable using macros.

ActiveDocument.RemoveVariable "vTestVariable1"

Note: It is not necessary to check whether the variable exists or not when calling ActiveDocument.RemoveVariable
If the variable does not exist, the function RemoveVariable does not throw an error.

This article is the translated version of the originally posted german article QlikTip #9: Löschen von Variablen.

Bookmark and Share

and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.