Defining a validation rule in the Database painter

This section describes the ways you can manipulate validation rules in the Database painter.

StepsTo create a new validation rule

  1. In the Extended Attributes view in the Database painter, right-click Validation Rules and select New from the pop-up menu.

    The Validation Rule view displays in the Properties view.

  2. Assign a name to the rule, select the datatype of the columns to which it applies, and customize the error message (if desired).

    For information, see “Customizing the error message”.

  3. Click the Definition tab and define the expression for the rule.

    For information, see “Defining the expression”.

    The sample shows the Validation Rule view open at the Definition tab. It displays buttons you can click to select Match or to paste @ col into the Validation Rule area at the bottom of the view. Also listed are the Functions you paste there.

You can use this rule with any column of the appropriate datatype in the database.

StepsTo modify a validation rule:

  1. In the Database painter, open the Extended Attributes view.

  2. In the Extended Attributes view, open the list of validation rules.

  3. Double-click the validation rule you want to modify.

  4. In the Validation Rule view, modify the validation rule as desired.

    For information, see “Defining the expression” and “Customizing the error message”.

StepsTo associate a validation rule with a column in the Database painter:

  1. In the Database painter (Objects view), position the pointer on the column, select Properties from the column’s pop-up menu, and select the Validation tab.

  2. Select a validation rule from the Validation Rule drop-down list.

    The column now has the selected validation rule associated with it in the extended attribute system tables. Whenever you use this column in a DataWindow object, it will use this validation rule unless you override it in the DataWindow painter.

StepsTo remove a validation rule from a column in the Database painter:

  1. In the Database painter (Objects view), position the pointer on the column, select Properties from its pop-up menu, and select the Validation tab in the Properties view.

  2. Select (None) from the list in the Validation Rule drop-down list.

    The validation rule is no longer associated with the column.