Constrain Values That Your User Can Select

Use the constrain keyword to apply a constraint at run time when the user manually selects an option or enters a value.

  • You can use the constrain keyword at the beginning of a constrain statement.
  • A constrain statement uses an expression to constrain a relationship.
  • You don't have to have a constrain keyword in a constrain statement.

You can include only one of these operators in each constrain statement:

  • Requires
  • Negates
  • Implies
  • Excludes

Here's an example of a constrain statement that uses the constrain keyword.

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

Here's an example that doesn't use constrain.

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

Here's an example constrain statement that uses FOR ALL...IN with an iterator.

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

Here's what it means in pseudocode:

If your user selects one option in the F1 feature, then select all other options in the F1 feature.