HELP!

Add Constraint Knowledge

The Add Constraint Knowledge Tool creates constraint knowledge objects. These can be in the form of trees, tables or procedures. Often a knowledge base will contain many of these constraint knowledge objects which interact to form a constraint domain.


This constraint knowledge when used with Dialog objects restricts the values of objects on the XpertForm view so that only the valid combinations are selectable.

When using the Add Constraint Knowledge build tool, the resulting object is placed in the object catalog, the user can then open this object to edit it.

The four different options are:

  • Constraint Tree - A tree structure which can graphically represent complex constraint relationships.
  • Constraint Table (Enforced Truth Table) - Constraint Logic is captured by enforcing the capture of all combinations of the truth table
  • Constraint Table (By Examples) - Constraint Logic is captured by providing Examples with a manual option for completing the remainder of the Truth Table. -Constraint Procedure - A Script object to programmatically define constraint relationships.

Constraint trees are built using various objects and the outcomes of the tree are valid or invalid. Constraints

image title

This is the same with Decision tables, every variation can be given and the outcome of the table can be valid or invalid.

image title

When there are many columns, building a truth table isn't viable so example rows are set that are valid or invalid to produce the knowledge.

On both types of table an induced decision tree can be automatically generated.

Multiple constraints trees are combined automatically if they share objects

Constraint Procedure

Constraint procedures are JavaScript script objects that programmatically define constraint relationships between question objects.

image title

They can be created by using the ‘Add Constraint Knowledge’ build tool or by taking an existing JavaScript script object and selecting question objects from the ‘Constraints’ menu on the right-hand side of the script editor.

image title

A Constraint procedure is indicated in the Decision Map and the Object Catalog by a blue marker to the right of the procedure’s name.

image title

A constraint procedure must include the return statement, where false returned indicates the constraints are violated and true returned indicates that the constraints are satisfied.

While a normal procedure is invoked either with a Do statement or from a decision tree, a constraint procedure cycle is invoked automatically from the XpertForm Dialog. This is done whenever the value of a dialog control tied to a constrained object changes (and for initial dialog set-up). For example, for a list type question this is done when a value is selected or deselected. For a numeric type question this is done when the focus is moved away from the dialog control (e.g. the tab key is pressed).

Constraint Procedure Cycle

When the value of a dialog control tied to a constrained object changes, for each constrained object on the dialog and then for each other object constrained with it:

Execute the constraint procedure n times

  • If the question has one value then n = 1
  • If the question is blank
    • For list type, n = the number of values, ie. what if each value was to be assigned to the attribute.
    • For numeric type, exit procedure with an implicit return true
  • If the logic of any constraint procedure results in return false then the value(s) are considered invalid.

On This Page