The INPUT ARRAY sub-dialog
The INPUT ARRAY
sub-dialog is the controller to implement the navigation
and edition in a list of records.
Program array to screen array binding
The INPUT ARRAY
sub-dialog
binds the members of the flat record (or the primitive member)
of an array to the screen-array or screen-record fields specified
with the FROM
keyword. The number of variables
in each record of the program array must be the same as the
number of fields in each screen record (that is, in a single
row of the screen array).
You typically bind a program
array to a screen-array in order to display a page of records. However,
the DIALOG
instruction can also bind the program
array to a simple flat screen-record. In this case, only one record
will be visible at a time.
The next code example defines an array with a flat record and binds it to a screen array:
DEFINE p_items DYNAMIC ARRAY OF RECORD
item_num INTEGER,
item_name VARCHAR(50),
item_price DECIMAL(6,2)
END RECORD
...
DIALOG
INPUT ARRAY p_items FROM sa.*
BEFORE INSERT
...
END INPUT
...
END DIALOG
If the screen array is defined with one field only, you can bind an array defined with a primitive type:
DEFINE p_names DYNAMIC ARRAY OF VARCHAR(50)
...
DIALOG
INPUT ARRAY p_names FROM sa.*
BEFORE DELETE
...
END INPUT
...
END DIALOG
Identifying an INPUT ARRAY sub-dialog
The name of the screen array specified
with the FROM
clause will be used to
identify the list. For example, the dialog class method such as DIALOG.getCurrentRow("screen-array")
takes
the name of the screen array as the parameter, to identify
the list you want to query for the current row. The name
of the screen-array is also used to qualify sub-dialog actions
with a prefix.
Control blocks in INPUT ARRAY
Editable record lists declared with the INPUT
ARRAY
sub-dialog can raise the following triggers:
- BEFORE INPUT
- BEFORE ROW
- BEFORE FIELD
- ON CHANGE
- AFTER FIELD
- ON ROW CHANGE
- AFTER ROW
- BEFORE DELETE
- AFTER DELETE
- BEFORE INSERT
- AFTER INSERT
- AFTER INPUT
In the singular INPUT ARRAY
instruction, BEFORE INPUT
and
AFTER INPUT
blocks are typically used as initialization and
finalization blocks. In the INPUT ARRAY
sub-dialog of a
DIALOG
block, BEFORE INPUT
and AFTER
INPUT
blocks are executed each time the focus goes to
(BEFORE
) or leaves (AFTER
) the group of fields
defined by this sub-dialog.