Choosing an interaction policy

For each decision node, you select a rule interaction policy that applies to all the rules and decision tables in this decision node. Interaction policies define how rules interact with each other by governing their order of execution, and ensure that the decision logic produces a consistent result.

Sequential policy

The sequential policy is the default policy, where rules execute in the order in which they are listed in a decision node. A rule can modify or overwrite decisions that were previously made by other rules. As a consequence, several rules might apply for a decision.

The first rule in a decision node can be used to initialize the decision. To use the first rule as an initialization rule, omit the condition part of the rule.

Example:

Take a decision node that contains two rules:


if
   'shopping cart value' is more than 100
then
   set discount to 10;

and


if
   'customer category' is "Gold"
then
   set discount to 15;

If both rules apply, the discount will be 15 because the second rule overwrites the first.

First rule applies policy

Rules execute in the order in which they are listed in the decision node. As soon as a rule applies and makes a decision, this decision is final for the impacted attributes, and the execution in the decision node stops. If a rule might apply several times, and is the first applicable rule, it will only apply once. Therefore, do not use this policy if the decision is a list that results from multiple instances of one or more rules.

Example:

Take a decision node that contains two rules:


if
   'customer category' is "Gold"
then
   set shipping cost to 0;

and


if
   'shopping cart value' is more than 100
then
   set shipping cost to 5;

If the customer category is "Gold", the first rule applies. This rule sets shipping cost to 0, and no other rules are executed.

Smallest and greatest value policies

All applicable rules execute and the order of execution does not matter. If you use the smallest value policy, the value of the decision is set to the minimum value available among the values that are obtained by the applicable rules. If you use the greatest value policy, it is set to the maximum value available.

You can use these policies for decisions of type number and integer, and that use the set decision to construct.

Example:

Take a decision node that contains two rules:


if
   'shopping cart value' is more than 100
then
   set shipping cost to 10;

and


if
   'customer category' is "Gold"
then
   set shipping cost to 0;

With the smallest value policy, shipping cost is set to 0 (minimum of 10 and 0).

Collect policy

All applicable rules execute. If you use the collect policy, the values of all applicable rules are collected and returned as a list. The execution order of rules does not influence which values are collected, but it impacts the order in which the collected values appear in the list.

You can use the collect policy for decisions that are multi-valued, and that use the add ... to decision construct.

Example:

Take a decision node that contains two rules:


if
   'shopping cart value' is more than 100
then
   add "Free mug" to promotions;

and


if
   'customer category' is "Gold"
then
   add "Extra loyalty points" to promotions;

If both rules apply, promotions contains ["Free mug", "Extra loyalty points"].

Sum policy

All applicable rules execute and the order of execution does not matter. If you use the sum policy, the values of all applicable rules are summed up.

You can use the sum policy for decisions of type number and integer, and that use the add ... to decision construct.

Example:

Take a decision node that contains two rules:


if
   'shopping cart value' is more than 100
then
   add 50 to bonus points;

and


if
   'customer category' is "Gold"
then
   add 100 to bonus points;

If both rules apply, bonus points is set to 150.

Important: If no rule is applicable, the value of the decision is null.

For a complete example of how to work with interaction policies, see the Training sample available on GitHub External link opens a new window or tab. Alternatively, you can import the Training sample from the Samples library in Decision Designer. For more information about the Samples library, see Building decision services.