Creating and Attaching a Constraint Rule

Validate and constraint business rules have their expressions generated as constaints for DBMSs where this is supported. Validate rules can be reused by multiple objects, but constraint rules can only be used once, and will be generated as a separate constraint for DBMSs that support multiple constraints.

Support for the generation of constraint rules to your database is controlled by the following items in the General category of your DBMS definition file:
  • EnableCheck - Permits the generation of constraints to the database.
  • EnableMultiCheck - Permits the generation of check parameters (see Setting Data Profiling Constraints) and validation business rules as a single constraint, followed by the generation of each constraint business rule as a separate constraint in the order in which they are attached to the table. If this option is not enabled, then check parameters and all constraint and validation rules are concatenated into a single constraint expression.
  • UniqueConstName - Requires that all validate and constraint rules have unique codes.

You can preview the constraints that will be generated on the Preview tab of the table property sheet.

When reverse engineering, the constraint order is respected, with the first constraint retrieved to the Check tab of the table property sheet, and each subsequent constraint retrieved as a constraint business rule attached to the table

  1. Create a business rule, enter a name and code, select Constraint in the Type list, and then click the Expression tab
  2. Enter an expression on the Server sub-tab:


  3. Click OK to save your changes and return to the model.
  4. Open a table or column property sheet and click the Rules tab.
  5. Click the Add Objects tool to open a list of available business rules, select your constraint business rule from the selection list and click OK to attach it.
  6. [optional] Click Apply to confirm the attachment of the rule and then click the table property sheet Preview tab to verify that the constraint has been created in the script.
    In the following example, multiple constraints are defined on the Project table:
    • Check parameter (in the Check tab of the table) - Verifies that the customer number is different from the employee number.
    • Validation business rules - PROJ_NUM to check that the column project number is not null and EMP_NUM to check that the employee number is not null.
    • Constraint business rule - DATE_CONSTY to check that the start date of the project is inferior to the end date of the project.