Understanding validation rules

Validation rules are criteria that a DataWindow object uses to validate data entered into a column. They are Sybase WorkSpace-specific and therefore not enforced by the DBMS.

Validation rules assigned in the Enterprise Explorer are used by default when you place columns in a DataWindow object. You can override the default rules in the DataWindow editor.

A validation rule is an expression that evaluates to either TRUE or FALSE. If the expression evaluates to TRUE for an entry into a column, Sybase WorkSpace accepts the entry. If the expression evaluates to FALSE, the entry is not accepted and the ItemError event is triggered. By default, Sybase WorkSpace displays a message box to the user. You can customize the message displayed when a value is rejected.

You can also code the ItemError event to cause different processing to happen.

NoteAt runtime In Java code, you can use the getColumnValidation method to obtain the validation rule for a column and the setColumnValidation method to change the validation rule for a column.