REQUIRED attribute

The REQUIRED attribute forces the user to modify the content of a field during an input dialog.

Syntax

REQUIRED

Usage

The REQUIRED attribute forces the user to modify the content of a field controlled by an input dialog (INPUT or INPUT ARRAY), when the INPUT dialog does not use the WITHOUT DEFAULTS option. Within INPUT ARRAY, the REQUIRED attribute always applies to newly created rows.

If an INPUT dialog uses the WITHOUT DEFAULTS clause, the current value of the variable linked to the REQUIRED field is considered as a default value; the runtime system assumes that the field satisfies the REQUIRED attribute, even if the variable value is null.

In an INPUT ARRAY dialog, the REQUIRED attribute always applies to newly created rows, even if WITHOUT DEFAULTS is used. In other words, when creating a new row, INPUT ARRAY behaves like INPUT without the WITHOUT DEFAULTS clause.

If REQUIRED is effective (WITHOUT DEFAULTS is not used), and a DEFAULT attribute is defined for the field, or the program variable corresponding to the field is initialized with a non-NULL value in BEFORE INPUT, BEFORE INSERT or BEFORE DIALOG, the runtime system assigns the default value to the field, and assumes that the REQUIRED attribute is satisfied.

The REQUIRED attribute does not prevent fields being null; If the field contains a value, and the user subsequently erases this value during the same input, the runtime system considers the REQUIRED attribute satisfied. To insist on a non-null entry, use the NOT NULL attribute.

Example

EDIT f001 = orders.ord_shipcmt, REQUIRED;