The CheckValue Method of Internal Domain Components

Previous Next

For each domain, domain attributes and (if any) domain constraints are a set of data validation/correction rules that you specify in order to restrict or correct data values submitted for storage in columns based on the domain. They help you preserve the validity and consistency of your data. You can enforce business rules using corrective behavior, restrictive behavior, or both. The combined effect of restrictive and corrective rules is to filter out bad data before attempting an insert or update.

Sometimes you need to provide instant feedback on the data submitted, and reduce the load on the engine. This technique is appropriate when you need to determine that data values are wrong or out of range in the beginning of the business process, so avoiding that any further implementation actions are run. For example, when a service is called, you might want to check the data submitted to the service against constraints defined on a domain.

Using the CheckValue method of the corresponding internal domain component of the domain, you can check arbitrary data values against the definition of domain attributes and restrictive domain constraints.

The component returns an empty value in case the check is successful, or a string containing the error message if the check fails.

Syntax

INVOKE domain.CheckValue WITH 

SELECT value

,      fieldname

,      useIOFormats
 
useIOFormats  :=  { No | Yes }

 

The required value is the value that will be checked against domain attributes and restrictive domain constraints.

The optional fieldname is used for the error returned by the component. If the error contains a field name, the string provided in this parameter will be used as that field name.

If the optional useIOFormats is passed with the 'Yes' value(the default is 'No'), the value to be checked is first converted according to the IO format defined by the domain. Alternative Input Formats will also be checked.

Corrective domain constraints (if any) on the domain have no effect on the outcome of a CheckValue call, except in error situations. The corrective behavior is triggered by a CheckValue call and will raise an error if, for example, the corrective rule calls some different component that (for some reason) returns an error message. Other than this possible error behavior, corrective rules have no effect when CheckValue is called, since there is no way that these rules can store their corrected values: there is no row binding at the time of calling CheckValue.

 

See Also

Internal Domain Components

Constraints