Preconditions

You define preconditions to create variable definitions that are available throughout the decision table and conditions that must be satisfied before the decision table is executed.

About this task

Preconditions provide a way to test data to determine whether it can be checked by a decision table. If the data from an application that calls a decision table does not satisfy the preconditions of the table, the rules in the table are not executed.

You can also use preconditions to modify incoming data, and declare variables for a decision table.

The preconditions of a decision table are managed outside the decision table, typically in a separate dialog that you access from the decision table. You state preconditions as rules, for example:
definitions
   set 'wealthy customer' to a customer
      where the average monthly balance of this customer 
                                      is more than $1 000 000
if
   the state of residence of 'wealthy customer' is NY

These preconditions start by defining the variable wealthy customer. The preconditions then limit the scope of the rules in the decision table to customers who have an average monthly balance of $1 million, and reside in the state of New York.

The preconditions are tested before each rule in a table is executed. If an application presents data that passes the preconditions of a decision table, the data is tested by the preconditions before each rule in the decision table is executed. For example, if a table contains 10 rules, the preconditions can be tested 10 times.

Procedure

To define a precondition:
  1. In the decision table editor, click Edit preconditions.
  2. In the preconditions editor, press Ctrl+Spacebar. The completion menu opens. You define variables and conditions in the Preconditions section in the same way that you would create variables and conditions for a business rule in the Rule editor. See Using the rule editor for details.
  3. Click Define.

Results

The variables that you defined are now available for creating condition definitions in the decision table. It means that the rows of the decision table cannot be evaluated before the conditions that are defined in the precondition are satisfied.