Understanding the INPUT ARRAY instruction

The INPUT ARRAY is a dialog instruct designed to browse and modify a list of record, binding a static or dynamic array model to a screen array of the current displayed form.

Use the INPUT ARRAY instruction to let the end user update, delete and create new records in a list, after fetching a result set from the database. The result set is produced with a database cursor executing a SELECT statement. The SELECT SQL statement is usually completed at runtime with a WHERE clause produced from a CONSTRUCT dialog.

The INPUT ARRAY instruction associates a program array of records with a screen-array defined in a form so that the user can update the list of records. The INPUT ARRAY statement activates the current form (the form that was most recently displayed or the form in the current window. )


INPUT ARRAY instruction diagram

Figure 1. The INPUT ARRAY instruction principle

During the INPUT ARRAY execution, the user can edit or delete existing rows, insert new rows, and move inside the list of records. The program controls the behavior of the instruction with control blocks such as BEFORE DELETE, BEFORE INSERT, etc.

INPUT ARRAY instruction diagram

Figure 2. During INPUT ARRAY the user can manipulate the rows in the list

To terminate the INPUT ARRAY execution, the user can validate (or cancel) the dialog to commit (or invalidate) the modifications made in the list of records.

Figure 3. INPUT ARRAY termination


INPUT ARRAY termination diagram

When the statement completes execution, the program must test the INT_FLAG variable to check if the dialog was validated (or canceled) and then use INSERT, DELETE, or UPDATE SQL statements to modify the appropriate database tables. The database can also be updated during the execution of theINPUT ARRAY statement.