Was this helpful?
Initialization of Fields and Variables
When you use a field name or column name as a variable in an expression, 4GL interprets the value at run time. When a form is first displayed, each field has a default value of either the empty string or zero, depending on the field's data type, with the following exceptions:
If a default value was assigned during definition through the ABF FormEdit operation, the default appears when the form is displayed in Fill mode.
If the value was passed into that field as a keyword parameter, that value appears.
If the 4GL specification assigns a value to the field with the initialize statement, that value appears.
The field retains its value until changed by either a 4GL statement or by you. Initial values assigned to fields and variables are described in the following table:
Type of Variable
Nullable?
Field or Variable?
Starting
Value
Any character type
Nullable
Field
Null
 
Non-nullable
Field
Empty string
 
Both
Variable
Empty string
Float
Nullable
Field
Null
 
Non-nullable
Field
0.0
 
Both
Variable
0.0
Decimal
Nullable
Field
Null
 
Non-nullable
Field
0.0
 
Both
Variable
0.0
Integer
Nullable
Field
Null
 
Non-nullable
Field
0
 
Both
Variable
0
Date
Nullable
Field
Null
 
Non-nullable
Field
Empty date
 
Both
Variable
Empty date
Money
Nullable
Field
Null
 
Non-nullable
Field
0.00
 
Both
Variable
0.00
Record
N/A
Variable
Attributes initialized according to user-defined record type
Array
N/A
Variable
Empty
Example
Set up two local variables and three hidden table-field columns, using SQL data types, and give the simple fields initial values:
initialize (
  idnum = integer,
  idname = varchar(10),
  emptbl.empnum = integer,
  emptbl.empsal = float,
  projtbl.projid = varchar(6)) = 
begin
  idnum = 0;
  idname = 'none';
end
Set a local array of type of table in preparation for using it in a procedure:
initialize = 
declare
  parttable = array of type of table part;
  name = char(16);
  pos = smallint;
begin
  callproc selectparts
    (parttable = parttable);
end
Last modified date: 04/03/2024