INPUT

The INPUT statement supports data entry by users into fields of a screen form

4GLREF00000155.gif

number is a literal integer to specify a Help message number.

The INPUT statement assigns to one or more variables the values users enter into the fields of a screen form. 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 this statement, you must do the following:

  1. Specify screen field(s) in a form specification file, and compile the form.

  2. Declare variable(s) with the DEFINE statement.

  3. Open and display the screen form in either of the following ways:

The OPEN FORM and DISPLAY FORM statements.

An OPEN WINDOW statement that uses the WITH FORM keywords.

  1. Use the INPUT statement to values to the variables from data that the user enters into fields of the screen form.

When the INPUT statement is encountered, 4GL does the following:

  1. Displays any default values in the screen fields, unless you specify the WITHOUT DEFAULTS keywords.

  2. Moves the cursor to the first field explicitly or implicitly referenced in the binding clause, and waits for the user to enter a value in that field.

  3. 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 statement activates the current form (the form that was most recently displayed, or the form in the current 4GL window). When the INPUT statement completes execution, the form is deactivated. After the user chooses Accept, the INSERT statement of SQL can insert values from the program variables into the appropriate database tables.

The Input Binding Clause

The binding clause temporarily associates fields of the screen form with 4GL variables, so that the 4GL program can manipulate values that the user enters in the form. INPUT statements supports two types of binding clauses:

In the special case where all of the variables have names that are identical (apart from qualifiers) to the names of simple fields and fields within screen arrays, you can specify INPUT BY NAME variable list to bind the specified variables to their namesake fields implicitly.

In the general case, you can specify INPUT variable list FROM field list to bind any combination of simple and structured variables explicitly to any combination of simple fields and fields within screen arrays.

4GLREF00000156.gif

Here variable supports the syntax of a receiving variable in the LET statement, but you can also use record.* or the THRU or THROUGH notation to specify all or some of the members of a program record.

The field names must be among those declared in the ATTRIBUTE section of the form specification file of the current form. These can include simple fields, members of screen records, multiple-segment WORDWRAP fields, and FORMONLY fields, but cannot include records from screen arrays.

The INPUT Form Management Blocks

Each INPUT 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 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 statement.

The next field to which to move the screen cursor.

When to terminate execution of the INPUT 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 statement (the EXIT INPUT statement)

Returning control to the user, without terminating the INPUT statement (the CONTINUE INPUT statement).

The activation clause and the statement block correspond respectively to the left-hand and right-hand elements in the following syntax diagram:

4GLREF00000157.gif

field in the name of a field in the current form.

key is one or more keywords to specify physical or logical keys.

statement is a SQL statement or other 4GL statement.

References

DEFER

DISPLAY ARRAY

INPUT ARRAY

OPEN WINDOW

OPTIONS