INPUT ARRAY
The INPUT ARRAY statement supports data entry by users into a screen array, and stores the entered data in a program array of records.
number is a literal integer to specify a Help message number.
The INPUT ARRAY statement assigns to variables in one or more program records the values that the user enters
into the fields of a screen array. This statement can include statement blocks
to be executed under conditions that you specify, such as screen cursor
movement, or other user actions.
To use the INPUT ARRAY statement, you must do the following:
- Specify a screen array in the form specification file, and compile the form.
- Declare an ARRAY OF RECORD with the DEFINE statement.
- Open and display the screen form in either of the following ways:
The OPEN FORM and DISPLAY FORM statements.
An OPEN WINDOW statement with the WITH FORM clause.
- Use the INPUT ARRAY statement to assign values to the program array from data
that the user enters into fields of the screen array.
When the INPUT ARRAY statement is encountered, 4GL does the following:
- Displays any default values in the screen fields, unless you specify the
WITHOUT DEFAULTS keywords.
- Moves the cursor to the first field and waits for input from the user.
- Assigns the user-entered field value to a corresponding program variable when
the user moves the cursor from the field or presses the Accept key.
The INPUT ARRAY statement activates the current form (the form that was most
recently displayed, or the form in the current 4GL window). When the INPUT ARRAY statement completes execution, the form is
deactivated. After the user presses Accept, the INSERT statement of SQL can insert the
values of the program variables into the appropriate database tables.
The Input Array Binding Clause
The binding clause temporarily associates the member variables in an array of program
records with fields in the member records of a screen array, so the 4GL program
can manipulate values that the user enters in the screen array:
program array is the name of an array of program records.
screen array is the name of an array of screen records.
You must declare the program array in your program, and the screen array in
the form specification file.
The INPUT ARRAY Form Management Blocks
Each INPUT ARRAY Form Management block includes a statement block of at least
one statement, and an activation clause that specifies when to execute the
statement block.
An INPUT ARRAY Form Management block can specify any of the following:
The statements to execute before or after visiting specific screen fields.
The statements to execute when the user presses a key sequence.
The statements to execute before or after the INPUT ARRAY statement.
The next field to which to move the screen cursor.
When to terminate execution of the INPUT ARRAY statement.
The activation clause can specify any one of the following:
Pre- and post-INPUT actions (the BEFORE or AFTER INPUT clause)
Pre- and post-INSERT actions (the BEFORE or AFTER INSERT clause)
Pre- and post-DELETE actions (the BEFORE or AFTER DELETE clause)
Keyboard sequence conditions (the ON KEY clause)
Cursor movement conditions (the BEFORE or AFTER FIELD clause, and
the BEFORE or AFTER ROW clause)
The statement block can include any SQL or 4GL statements, as well as:
Cursor movement instructions (the NEXT FIELD or NEXT ROW clause)
Termination of the INPUT ARRAY statement (the EXIT INPUT statement)
Returning control to the user, without terminating the INPUT ARRAY statement
(the CONTINUE INPUT statement).
If you include one or more form management blocks, the END INPUT keywords must
terminate the INPUT ARRAY statement. If no form management block is included,
4GL waits while the user enters values into the fields. When the user presses
the Accept key, the INPUT ARRAY statement terminates.
The activation clause and the statement block correspond respectively to the
left-hand and right-hand elements in the following syntax diagram:
keyname is one or more keywords to specify physical or logical keys.
statement is an SQL or other 4GL statement.
References
DEFER
DISPLAY ARRAY
INPUT
OPEN WINDOW
OPTIONS
SCROLL