2. Overview of Tools and Languages : Terms and Concepts : Variables
 
Share this page                  
Variables
Variables contain the data that the application manipulates. This includes data that is displayed to the user as well as data that is used internally in frames and procedures.
Variables are created using ABF frames or 4GL code. The user can change the value that the variable represents as the application runs.
There are three types of variables in 4GL:
Simple Variables
Are single data items that contains one value, of any Ingres data type.
Record Variables or Records
Are a named set of attributes. Each record variable must be of a defined record type. See Record Types.
Arrays
Are named sets of records. See the section Arrays in Record Types.
Variables can have global or local scope in an application:
Global Variables
Provide data for an entire application. They can be used to maintain a value that is set once and rarely changed, such as the user name. They can be referenced in any frame or procedure, allowing easy access to the information. A global variable can be any data type.
Local Variables
Provide data for a specific procedure, frame, or form. They can be used only within the procedure or frame for which they are declared. A local variable can be any data type, and is defined with 4GL code.
Global variables can be used in any statement in which a local variable can be used. A local variable overrides a global variable with the same name.
You can declare a local variable to be based on an existing form, table field, or table. Global variables cannot be based on a form object.