<< ibec_FreeGlobalVar | IBEBlock | ibec_GetLastError >>

ibec_GetGlobalVar

ibec_GetGlobalVar returns the value of a specified global variable. If the variable does not exist, this function returns the value passed in DefaultValue.

Syntax

 function ibec_GetGlobalVar
    (VarName : string; DefaultValue : variant) :variant;

Example

The following example illustrates the use of this function, together with ibec_SetGlobalVar, described within an SQL script:

     CONNECT ...;

     execute ibeblock
     as
     begin
       select myfield from mytable
       where something = 25
       into :MyVar;
       ibec_SetGlobalVar('MyGlobalVar', MyVar);
     end;

     ...

     execute ibeblock
     as
     begin
       MyVar = ibec_GetGlobalVar('MyGlobalVar', null);
       if (MyVar = 1) then
         insert into mytable ...;
       else if (MyVar = 2) then
         update mytable set ...;
     end;

It is also possible to to specify global VAR values for IBEBlocks using the command line:

 -G<variable_name>=<value>. 

Or alternatively specify global VAR values using INI files. Please refer to IBEScript for details and examples.

back to top of page
<< ibec_FreeGlobalVar | IBEBlock | ibec_GetLastError >>:)