NEXT FIELD keywords

NEXT FIELD keywords specify the field to which the cursor will be moved. If no NEXT FIELD keywords are specified, the cursor will be moved to the next field according to the field order set by the Binding clause. The user moves form field to field with the help of the TAB, RETURN and arrow keys. The NEXT FIELD keywords change the default movement of the screen cursor.

The NEXT FIELD keywords can be followed by:

In the following example the field var1 should be filled so if it contains NULL value when the cursor is moved to another field, the NEXT FIELD clause returns the cursor to this field:

INPUT BY NAME var1, var2, var3, var4

AFTER FIELD var1

  IF var1 IS NULL THEN

    DISPLAY "You should enter data in this field" AT 2,2

    NEXT FIELD var1

  END IF

END INPUT

4GL does not execute the statements within an optional INPUT control clause that follow the NEXT FIELD keywords and moves the cursor immediately to the specified field. In the example below, the function_1() is not called if the IF condition is met:

INPUT BY NAME var1, var2, var3, var4

AFTER FIELD var1

  IF var1 IS NULL THEN

    DISPLAY "You should enter data in this field" AT 2,2

    NEXT FIELD var1

  END IF

    CALL function_1 ()

END INPUT

The NEXT FIELD keywords may appear in any INPUT control clause, they usually appear within conditional statements as in the example above, but they may be used outside the conditional statements. The NEXT FIELD keywords can be used in a conditional statement within the BEFORE FIELD clause, if you want to restrict the access to this field.

Be aware that if the NEXT FIELD keywords occur outside a conditional statement within the AFTER INPUT clause, the user will be unable to leave the INPUT statement.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.