![]() | Constraint Trees | Constraint Map | ![]() |
In addition to the knowledge inference modes supported in XpertRule (decision trees, pattern matching and cases), you can also define constraint procedures which can be used to impose constraints on components and attributes captured via user dialogs.
To use a Procedure as a Constraint Procedure, you must first select the Constraint check box at the top of the procedure window.
When you then use the Alter the List of Constrained Objects tool you can select (and deselect) one or more objects to be used as constrained objects within the current procedure.
A constraint procedure must include the @Return statement, where 0 returned indicates the constraints are violated and 1 returned indicates that the constraints are satisfied.
While a normal procedure is invoked either with a @Do command or from a decision tree, a constraint procedure cycle is invoked automatically from the Graphical Dialog. This is done whenever the value of a Control tied to a Constrained Attribute/Component changes (and for initial dialog set-up). For example, for a List Attribute this is done when a value is selected or deselected. For a Numeric Attribute this is done when the focus is moved away from the Control (e.g. the Tab key is pressed).
Constraint Procedure Cycle
When the value of a Control tied to a Constrained Attribute changes, for each constrained Attribute on the dialog and then for each other Attribute constrained with it:
Execute the constraint procedure n times
-For List, n = the number of values. i.e. what if each value was to be assigned to the attribute.
-For Numeric, exit procedure with an implicit @Return 1
The mechanics of editing a Constraint Procedure window and the use of procedural commands are identical to when using standard Procedure and Event windows. See the chapter on XpertRule scripting for more information on editing and commands.