validatefield

Validate a field of the current occurrence.

validatefield  Field

Example: validatefield "CUSTID.CUSTOMER"

Parameters

Parameters
Parameter Data Type Description
Field String Field to validate

Return Values

Values returned in $status
Value Meaning
<0 An error occurred. $procerror contains the exact error.
>=0 Statement executed successfully
Values Commonly Returned by $procerror Following validatefield

Value

Error constant Meaning
-34 <UGENERR_CURRENCY> Changes to the active path not allowed.
-35 <UGENERR_4GL_SAYS_ERROR> A trigger returned a negative value in $status.
-300 <UVALERR_SYNTAX> An error in declarative syntax occurred.
-1101 <UPROCERR_FIELD> An incorrect field name was provided; either the field name is not valid syntactically or the field is not available in the component.

Whenever an error occurs, the field-level error is activated. The function $dataerrorcontext contains information about the exact context of the error, and the function $procerrorcontext indicates the exact location of the error.

Use

Allowed in all component types, except self-contained Reports.

Description

The validatefield statement validates the specified field of the current occurrence. If the field is marked as modified and has not been successfully validated or if $fieldcheck is 1, declarative checks for Field are performed and the validate trigger is activated. For more information, see validate.

If the field is successfully validated, the validate trigger sets $fieldvalidation to 0.

Note:  Validation statements (validatefield, validatekey, validateocc, and validate) activate the validation triggers such as validate and validatekey. You should therefore be careful when using these statements in validation triggers.

$MYFIELD$ = "CUSTID.CUSTOMER"
validatefield $MYFIELD$

Related Topics