21. 4GL Statement Glossary : Inittable
 
Share this page                  
Inittable
Changes the display mode and clears the data set of a table field.
Syntax
inittable tablefieldname modetype 
tablefieldname
Specifies the name of the table field being reinitialized. This is a 4GL name.
modetype
Specifies a 4GL name that specifies one of the following mode types available for displaying table fields:
read
Specifies that the user can view but not add or modify rows
update
Specifies that the user can modify but not add rows
fill
Specifies that the user can modify or add rows
query
Specifies that the user can add or modify row with query operators
Description
The 4GL inittable statement changes a table field's display mode and clears any associated data. When a frame first appears in an application, the form and any table fields are initialized to Fill mode, which permits the application user to enter values into them. Use the inittable statement to:
Reinitialize a table field to a different mode
Clear the named table field of all values
Inittable erases any values a table field receives from another frame through the parameter list of a callframe statement. Do not use inittable in the initialize block in this case. Instead, place the query that loads the table field in the current frame's initialize block, after inittable.
Both the inittable and mode statements can alter the effective mode of a table field. The mode statement changes the mode of the form as a whole. The mode of a table-field is set independently of the form as a whole, with this exception: When the form is in Read mode, the table fields in the form are also forced to behave as if they were in Read mode. This forced behavior only lasts until the form's mode changes out of Read mode. At this point, the individual modes of the table fields are in effect again. The inittable statement does not operate on hidden columns.
Examples
Clear the emptbl table field and change its mode to Update:
inittable emptbl update;
Clear the emptbl table field, changing its mode to the one specified in the field called modetype in the current form:
inittable emptbl :modetype;