Validate
Performs the field validation checks previously established in the Visual-Forms-Editor (VIFRED).
Syntax
validate
validate field fieldname
fieldname
Specifies the name of a simple field or table field. A 4GL name.
Description
The 4GL validate statement checks the contents of the form against the validation criteria you establish for it using the ABF FormEdit operation to access VIFRED. If any field fails a check, an error message is displayed, the application breaks out of the operation currently in progress, and the cursor moves to the field that failed the check.
The validate statement initiates a validation check immediately upon execution, independent of any action taken by you. This differs from validations that occur as a result of the set_forms frs (validate) statement, in which the validation takes place when you perform an action (such as moving to the next or previous field).
The two variants of the validate statement are validate and validate field:
• Validate has no parameters. Validation checks are performed on every field in the current form for which validation checks are specified in VIFRED. At minimum, basic data type checking is done.
• Validate field has the single parameter, fieldname. This statement performs checks on the specified field or table field only. If you specify a table field, the data in all the table-field's displayed rows is validated.
To validate single rows in a table field, use the validrow statement, discussed in the following section.
When the form is in Query mode, the validate statement validates a field's datatype and query operators.
Examples
Validate the data in the field called Salary:
validate field salary;
Validate the data in the field on the form with the name found in the field Valfield:
validate field :valfield;
If the field Valfield contains the word "Salary", the above example validates the data in the Salary field.
Last modified date: 08/28/2024