21. 4GL Statement Glossary : Initialize
 
Share this page                  
Initialize
Sets the initial values in an ABF frame.
Syntax
initialize [([variable = typedeclaration
  {, variable = typedeclaration}]
  [tablefieldname.hiddencolumnname = typedeclaration
  {, tablefieldname.hiddencolumnname =
   typedeclaration}])] =
[ declare [ variable = typedeclaration
  {, variable = typedeclaration}]
  [tablefieldname.hiddencolumnname = typedeclaration
  {, tablefieldname.hiddencolumnname =
    typedeclaration}] ] 
[begin | {
    statement; {statement;}
end | }]
The following are the parameters for the initialize and declare sections:
variable
Specifies the name of a local variable to hold temporary values in the form
tablefieldname.hiddencolumnname
Specifies the name of a hidden column within a table field on the form. Hidden columns must be of simple data type.
typedeclaration
Specifies the data type and length of the variable, record type name, or column. Use one of these formats:
simpletype [(length[,scale])] [with|not null];
recordtype;
array of recordtype;
array of type of table tablename;
array of type of form formname;
array of type of tablefield form.tablefield;
Description
The 4GL initialize statement declares any local variables in the frame and any hidden columns in the frame's table fields. This statement can also provide a set of 4GL statements to execute when the frame starts up.
The initialize statement is optional, but when it appears it must come first in the 4GL source file. It can include two sections, initialize and declare. The optional declare section follows the initialize section. Enclose start-up statements in the initialization section in a set of braces or the keywords begin and end.
Declarations name the local variables and hidden columns and specify their data types. See Data Types for Simple Local Variables and Hidden Columns for a description of data types in 4GL.
Variables and hidden table-field columns contain the data that the application manipulates, but are not displayed on the form. While they are invisible and inaccessible to you, they are accessible to the application in the same ways as are displayed fields and columns. A hidden column must be of a simple Ingres data type. A 4GL local variable can be of any Ingres- or user‑defined data type.
4GL recognizes record type names in local variable declarations, which define records as instances of a record type and in references to these records and their attributes. All form fields and table field columns are accessible as keyword parameters for 4GL frames and procedures.
Initialize Section
Local variables and hidden columns declared in the initialize section can be accessed by calling frames, which can pass values into them.
Declare Section
4GL supports local variable declarations that are distinct from the parameter declarations in the initialize section. To declare variables whose scope is limited to the frame in which they are defined, use the keyword declare following the initialize section. Do not use the declare keyword unless you are declaring at least one local variable or hidden column.
You cannot pass values to local variables and hidden columns defined in the declare statement through the call parameter lists either positionally or by keyword; these variables and columns cannot be accessed by other frames. See Coding 4GL Procedures for more information.