The following steps describe how to use the INPUT
ARRAY statement:
Create a form specification file containing a screen array.
The screen array identifies the presentation elements to be used by
the runtime system to display the rows.
Make sure that the program controls interruption handling
with DEFER INTERRUPT, to manage the validation/cancellation
of the interactive dialog.
Define an array of records with the DEFINE instruction.
The members of the program array must correspond to the elements of
the screen array, by number and data types. If you want to input data
from a reduced set of columns, you must define a second screen array,
containing the limited list of form fields, in the form file. You
can then use the second screen array in an INPUT ARRAY a FROM
sa.* instruction.
Open and display the form, using a OPEN WINDOW
WITH FORM or the OPEN FORM / DISPLAY
FORM instructions.
If needed, fill the program array with data, for example
with a result set cursor, counting the number of program records being
filled with retrieved data.
Set the INT_FLAG variable to FALSE.
Write the INPUT ARRAY statement to handle
data input.
Inside the INPUT ARRAY statement, control
the behavior of the instruction with control blocks such as BEFORE
INPUT, BEFORE INSERT, BEFORE
DELETE, BEFORE ROW, BEFORE
FIELD,AFTER INSERT,AFTER DELETE,AFTER
FIELD,AFTER ROW, AFTER INPUT and ON
ACTION blocks.
Get the new number of rows with the ARR_COUNT() built-in
function or with DIALOG.getArrayLength().
After the interaction statement block, test the INT_FLAG predefined
variable to check if the dialog was canceled (INT_FLAG=TRUE)
or validated (INT_FLAG=FALSE). If the INT_FLAG variable
is TRUE, you should reset it to FALSE to
not disturb code that relies on this variable to detect interruption
events from the GUI front-end or TUI console.