GlobalVarGet Function

Action

Gets the value of a global integer variable. Global variables are accessible for all users on all agents.

Include file

Kernel.bdh

Syntax

GlobalVarGet( in  sVariable : string,
              out nValue    : number,
              in  nTimeout  : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sVariable Name of the global variable whose value is to be retrieved.
nValue Variable receiving the value of the global variable.
nTimeout Optional: Timeout for getting the value in seconds. If the specified time period is exceeded, Silk Performer indicates an error.

The function’s default behavior is to wait until the get operation is done.

Example

dcltrans
  transaction TInit
  begin
    if GetUserID() = 1 then
      GlobalVarSet("global counter", 1000);
    end;
    GlobalWaitFor("All", ALL_USERS);
  end TInit;

  transaction TMain
  var
    nCount: number;
  begin
    GlobalVarGet("global counter", nCount);
    writeln(nCount);
  end TMain;