User-Defined Global Variables in Method Calls

Previous Next

See Also

You can use method calls to store values in user-defined global variables and refer to them in other method calls.

USoft does not recommend the use of global variables except in the rare cases where a variable is constantly being referred to from different runtime contexts (info windows, dialogs, or controls).

· To store temporary values in variables, use the HiddenVariable control class or insert text boxes and make them non-displayed.


· To pass values between one runtime window and another, create user-defined properties.


· To set a user-defined global variable, call the ResourceFileUpdate() method. As its only parameter, this method takes settings of the following type:

flag_1: Y

The syntax of calling this method to create or reset global variables is:

ResourceFileUpdate('<global_variable_name>: <string value>')

You can create as many concurrent global variables as you like. Make sure that each global variable name is unique and that it cannot be interpreted as a GUI class name. Global variables remain available until the end of the user session.

If you set an already existing global variable, the current value of that variable is overwritten.

Example 1

To create a global variable "flag_1" and set its value to 'Y', write:

ResourceFileUpdate('flag_1: Y')

Example 2

To create a global variable "flag_1" and set its value to the string currently in the NAME field, write:

ResourceFileUpdate(FORMULA(':1 || :2', 'flag_1: ',

Once set, a global variable can be referred to in SQL contexts by preceding the variable name by a colon and surrounding it by double quotes:

:"<global variable name>"

Example 3

To perform a certain action if the "flag_1" variable currently has the value 'Y', write a Decision with the following Decision SQL statement:

:"flag_1" = 'Y'

Set the Yes Action to the method call script to be executed if this condition is met.