Util.FreeGlobalVar

Top  Previous  Next

 

Syntax

function Util.FreeGlobalVar(VarName: string): integer

 

Alternative Names

ibec_FreeGlobalVar

 

Description

Removes the global variable identified by VarName from the list of variables and frees the memory for the variable. If VarName is an empty string, all variables are removed.

 

The Return Value is the number of variables removed.

 

See Also

Util.GetGlobalVar
Util.SetGlobalVar

 

Example

execute UDSBlock

as

begin

  try

    /* create a few global variables */

    Util.SetGlobalVar('var1', 100);

    Util.SetGlobalVar('var2', current_date);

    Util.SetGlobalVar('var3', 'this is variable 3');

  

    /* retrieve the values for the variables */

    GUI.ShowMessage('unknown var: ' || Util.GetGlobalVar('unknown var', 'not found'));

    GUI.ShowMessage('var1: ' || Util.GetGlobalVar('var1', 'not found'));

    GUI.ShowMessage('var2: ' || Util.GetGlobalVar('var2', 'not found'));

    GUI.ShowMessage('var3: ' || Util.GetGlobalVar('var3', 'not found'));  

  finally

    /* free global variables, either one-by-one or all at the same time */

    GUI.ShowMessage('free-ed ' || Util.FreeGlobalVar('var1') || ' variable.');

    GUI.ShowMessage('free-ed ' || Util.FreeGlobalVar('') || ' variables.');  

  end;        

end