Using decision tables in the Process Designer

You can author decision tables in a Decision task to implement decision logic in your service flow. A decision table can also be exported for use in IBM® Operational Decision Manager.

Before you begin

You must create a service flow and add a decision task to it, as described in Adding a Decision task to a service flow

Procedure

The following steps illustrate how to add a simple decision table to an existing Decision task.

  1. Click the Decisions tab to open the decision editor.
  2. Select your Decision task, for example, Approval.
    The editor opens with a basic template for a simple rule, with one condition (if) and one action (then). Click the X on the right side to delete that action rule.
  3. Add a decision table.
    1. Click Add a decision table.
      A default decision table is shown that contains a condition column (C0), an action column (A0), and twenty rows.
    2. Change the labels of the columns by double clicking the column header and entering the new name.
      For example, change C0 to Amount, C2 to Rating, and A0 to Approval.
    3. Save your work by pressing Ctrl+S.
  4. Define the rules for the decision table.
    For example,
    • If the amount is between 0 and 10000 and the rating is at least 100, set Approval to approve.
    • If the amount is between 10001 and 100000 and the rating is at least 200, set Approval to approve.
    • If the amount is between 100001 and 1000000 and the rating is at least 300, set Approval to approve.
    1. Define the conditions for the columns.
      1. Right-click the Amount column header and choose Define column. An editor window for defining conditions opens.
      2. Click in the window and press the space bar to see the options.
      3. Choose the amount variable and press the space bar again.
      4. Choose is between min and max and click Define at the bottom of the editor window. The condition for the first column is now defined. Check that you see min and max labels below the Amount column header.
      5. Double-click the first row below the min and max labels and enter 0 for the min value and 10000 for the max value.
      6. In the second row, enter 10000 for the min value and 100000 for the max value. Check that you get an error for overlapping values. Change the min value from 10000 to 10001.
      7. In the third row, enter 100001 and 1000000 for the min and max values.
    2. Define the Rating column as rating is at least <a number>.
      1. Right-click the Rating column header and choose Define column. An editor window for defining conditions opens.
      2. Click in the window and press the space bar.
      3. Choose the rating variable and press the space bar again to see the options.
      4. Choose the is at least <a number> option and click Define.
      5. Provide the numbers by double-clicking on the rows, and entering 100, 200, and 300.
    3. Define the Approval column as set approval to approve.
      1. Right-click the Approval column header and choose Define column. An editor window for defining conditions opens.
      2. Click in the window and press the space bar.
      3. Choose the set <variable> to <variable value> option.
      4. Click <variable> and choose approval.
      5. Click <variable value> and choose <string>.
      6. Enter approved between the “” and click Define.
      The definition of the decision table is complete.
      Tips:
      • You can use the keyboard shortcut Ctrl+F to open a search field that will perform a search on all values that are in the decision table.
      • Move the mouse pointer over the row numbers to see the rules as if-then rules.
    4. Save your work by pressing Ctrl+S.

Results

You have added a decision table to a Decision task in a service flow, which can be called from within your process application.

What to do next

The previous example only shows how to define a decision table, and does not model when a credit approval would be rejected.

A decision task can actually consist of several decision tables. To model what happens when the rating is below the number given in the table you could add another decision table that differs from the first one as follows: the RATING column is defined as is less than <number> and the string in the APPROVAL column is “rejected”. The AMOUNT column stays the same. Once this table is added below the existing one you will have modeled something like the following:
If 
AMOUNT is between 10001 and 100000 and the RATING is at least 200
then
approve is set to approved.  
This is the rule of the first table that does not fire when RATING has a value of 180. Instead, the second decision table comes into play and its rules are checked.
If
AMOUNT is between 10001 and 100000 and the RATING is less than 200
then
approve is set to rejected.
You can also add action rules to the decision task, as described in Using action rules. This gives you a powerful tool to express your rules according to your needs.
Tip: Decision tables are based on IBM Operational Decision Manager Business Rules Embedded. For more information, see the following IBM Operational Decision Manager documentation topics: