CDL Constraint Statements and the CONSTRAIN Keyword

The CONSTRAIN keyword is used at the beginning of a constraint statement.

A constraint statement uses an expression to express constraining relationships. You can omit the CONSTRAIN keyword from a constraint statement.

Each constraint statement must contain one and only one of the following keyword operators:

  • REQUIRES

  • NEGATES

  • IMPLIES

  • EXCLUDES

For a description of these constraints, see the topic on Logic Rules.

Examples

The following examples show constraint statements with and without the CONSTRAIN keyword.

Constraint statements with the CONSTRAIN keyword

CONSTRAIN a IMPLIES b;
CONSTRAIN (a+b) * c > 10 NEGATES d;

Constraint statements without the CONSTRAIN keyword

a IMPLIES b;
(a + b) * c > 10 NEGATES d;

The following example expresses that if one Option of Feature F1 is selected, then by default select all the rest of the Options.

Constraint Statement with the FOR ALL...IN Iterator

CONSTRAIN F1 DEFAULTS &var1
FOR ALL &var1 IN F1.Options();