Constraint_Validate

See Also: Constrain, Found

Purpose

Tests whether all the constraints in the current constraint set are satisfied by the data in the record buffers.

The DataDictionary class provides superior functionality that replaces the need for this command.

Syntax

Constraint_Validate

What It Does

Constraint_Validate applies all the constraints in the current constraint set to the data in the record buffers. If the validation is successful, the Boolean expression Found will be set to TRUE. Otherwise, Found will be set to false.

Constraint_Validate is most-frequently used for enforcing compliance with the current constraint set on records to be saved.

// How to validate on a set of constraints.

Object Constrainer is an Array

    Procedure SetConstraints

        Constraint_Set Self

        // Constrain customers from California whose names start with "R"

        Constrain customer.state EQ "Ca"

        Constrain customer.name Matches "R*"

    End_Procedure

 

    Function ConstraintValidation Returns Integer

        Constraint_Set Self

        Constraint_Validate

        If (Not (Found));

           Send Stop_Box "Error" "Validation Failed!"

        Function_Return (Found)

    End_Procedure

End_Object

Notes