The Globals Submenu of the Edit an Application Frame
The Globals operation of the Edit an Application Frame menu displays the Globals menu on the menu line. Through this menu, you can define and edit global variables, constants, and record types for your applications. See the Introduction chapter for a discussion of these terms.
When planning your application, consider where you can use these global components.
Global variables
If your application makes repeated use of a certain value—for example, the name of the current user of the application—you can define this value as a global variable. After you create a global variable, you must write 4GL code (usually in an application's starting frame or procedure) to set its initial value. You then can change the value of the global variable while the application is running.
A global variable can have as its data type a simple
Ingres type (for example, integer or character), a record type that you have created, or an array.
Global variables can be used wherever local variables are used. However, you must use a local variable unless the variable is used in several frames. Replacing all local variables with global variables increases compilation time.
Constants
If your application uses the same value several times—for example, the current ales tax rate—you can store this value in an application constant. You set the value of a constant when you create it; this value cannot be changed while the application is running.
Global constants must have a simple Ingres data type. They cannot be date or money data types or of a record type.
Record types
If certain grouping of related information occurs together throughout an application, you can group these in a record type. You can treat the objects in a record type as a single object, creating, for example, a combination of Business Name and City, or Customer Name, Address, and City.
In naming these components, consider these issues:
• A global variable cannot have the same name as a global constant. Local variable names override global variable and constant names when these conflict.
• Record types can have names that conflict with those of other components.
You can use global components in any frame or procedure of an application. For information on using 4GL code to reference and manipulate these global components, see the 4GL section of this guide.
Last modified date: 08/14/2024