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:
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: 08/14/2024