Rows and cells

In a decision table, the values in the cells of the row describe the conditions and actions of the rule.

You create a rule by adding a row to a table, and entering values in the cells for conditions and actions:

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A 100,000 300,000 true 0.001
2 A 300,000 600,000 true 0.003
3 B 600,000 900,000 true 0.005

The decision engine executes the rules row by row, from the first row to the last row.

Partitions

You can group a set of consecutive rows that have the same value for a given condition. In this case, the cells to the right of the grouped values are part of the same partition. All cells in the first column of the table belong to the same partition by definition.

Note: If you are using the editor with right-to-left orientation, the partition consists in the cells to the left of the grouped values.

In manual row ordering mode, you manage the grouping of conditions as you edit the table and add rows. In automatic row ordering mode, rows are automatically grouped when they share a condition value when you save and when you click the Optimize Row Order button. For more information, see Row ordering .

The following table shows the rows before they are organized into partitions:

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A < 100,000 false
2 B < 100,000 false
3 A 100,000 300,000 true 0.001
4 B 300,000 100,000 true 0.0025

The following table shows the rows after they are organized into partitions:

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A < 100,000 false
2 A 100,000 300,000 true 0.001
3 B < 100,000 false
4 B 300,000 100,000 true 0.0025

In the following table, the Grade A cells of rows 1 and 2 are grouped. As a consequence, the cells that correspond to the amount of the loan become part of the same partition.

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A 100,000 300,000 true 0.001
2 A 300,000 600,000 true 0.003

You read the two rules as follows:

  • Rule 1

    if
       all of the following conditions are true:
          - the loan grade is A
          - the amount of loan is between 100000 and 300000
    then
       - set the insurance required to true
       - set the loan rate to 0.001
  • Rule 2

    if
       all of the following conditions are true:
          - the loan grade is A
          - the amount of loan is between 300000 and 600000
    then
       - set the insurance that is required to true
       - set the loan rate to 0.003

A partition cannot be derived solely based on the fact that rows have the same a value. In the following table, we added a row at the top of the table with the same value for the grade as the other rows. Because its value for the grade is not grouped with the others, it creates a new partition for the amount of the loan and the existing partition remains the same.

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A 50,000 100,000 false 0.001
2 A 100,000 300,000 true 0.001
3 A 300,000 600,000 true 0.003

The following example shows a bigger table with several partitions. Cells A and B in the Grade column each have a partition of cells in the Amount of loan column. It means that if a loan request has an A grade, one of rules 1 - 4 might apply depending on the amount of the loan. Here, for example, the possible values for the amount are partitioned into the following ranges: less than 100000, at least 100000 and less than 300000, at least 300000 and less than 600000, and at least 600000. These ranges are tested in the cells on the right of grade A.

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A < 100,000 false
2 A 100,000 300,000 true 0.001
3 A 300,000 600,000 true 0.003
4 A ≥ 600,000 true 0.005
5 B < 100,000 false  
6 B 100,000 300,000 true 0.0025
7 B 300,000 600,000 true 0.005
8 B 600,000 800,000    
9 B ≥ 600,000 true 0.0075

Each numbered row in the table still forms a rule. Partitioning helps you compare rules with similar conditions, and find overlaps and gaps between values of the rules.

Empty cells

A row can contain empty cells. If an empty cell is in a condition column and there is at least one condition in the row, the condition that is associated to the empty cell is ignored. In this case, the next cell or partition on its right, if any, is evaluated. If a row contains only empty cells in the condition columns, the rule is not applicable and the entire row is ignored, even if there are actions in the action columns.

The following table illustrates different rows that contain empty cells:
  • In row 3, the decision is based on the grade and on the duration of the loan. The amount of the loan is ignored.
  • In row 4, the decision is based solely on the grade.
  • Row 5 is ignored because it contains no condition.
  Grade Amount of loan Duration of loan Insurance required Insurance rate
Min Max
1 A 100,000 300,000 12 true 0.001
2 A 300,000 600,000 24 true 0.003
3 A   12 true 0.008
4 B       true 0.004
5         false 0.005

If an empty cell is in an action column, the action cell is ignored. In the following table, the first rule does not set an insurance rate.

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A < 100,000 false
2 A 100,000 300,000 true 0.001
3 A 300,000 600,000 true 0.003
4 A ≥ 600,000 true 0.004

Otherwise cells

You can use an Otherwise cell to collect all the values that are not already covered in a partition.

The behavior of otherwise cells can change in the presence of empty cells. Using both otherwise and empty cells in the same partition is not recommended because it might create overlaps and make the table difficult to understand.

The meaning of otherwise cells follows these principles:
  • If a partition contains an otherwise cell and cells with values, the otherwise cell applies to values that are not already covered by other cells in the partition.
  • If a partition contains an otherwise cell, empty cells, and cells with values, the otherwise cell ignores empty cells and applies to values that are not already covered by other cells in the partition.
  • If a partition contains an otherwise cell and no other cell, the otherwise cell becomes irrelevant and is ignored.
  • If a partition contains an otherwise cell and all its other cells are empty, the otherwise cell becomes irrelevant and is ignored.

In the following table, the Otherwise cell collects all the values before 100000 and after 600000:

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A 100,000 300,000 true 0.001
2 A 300,000 600,000 true 0.003
3 A Otherwise true 0.004

If the grouping of the values for the grade was different, the table might look like this:

  Grade Amount of loan Insurance required Insurance rate
Min Max
1 A 100,000 300,000 true 0.001
2 A 300,000 600,000 true 0.003
3 A Otherwise true 0.004

You read the three rules as follows:

  • Rule 1

    if
       all of the following conditions are true:
          - the loan grade is A
          - the amount of loan is between 100000 and 300000
    then
       - set the insurance required to true
       - set the loan rate to 0.001
  • Rule 2

    if
       all of the following conditions are true:
          - the loan grade is A
          - the amount of loan is between 300000 and 600000
    then
       - set the insurance that is required to true
       - set the loan rate to 0.002
  • Rule 3

    if
       all of the following conditions are true:
          - the loan grade is A
          - it is not true that the amount of loan is between 300000 and 600000
    then
       - set the insurance that is required to true
       - set the loan rate to 0.003

If the grade is A and the amount of the loan is 200,000, both rules 1 and 3 apply and the table displays a warning because there is an overlap. The last row that applies is the third row, so the third rule is executed and the rate of the insurance is set to 0.003.