ILOG Rules for .NET User Guides > Rule Studio > Writing Rules > Working with Decision Tables > Understanding Rows and Columns

This section helps you to understand the relationship between the columns and rows of your decision tables and the rules that they store.

Columns

The columns of a decision table define the conditions and actions that apply to the rules contained in the table. Condition columns are unshaded and appear on the left, while the action columns appear shaded and on the right:

images/dtable_columns.png

The actions of a given rule are performed when all of its conditions are valid. For example, the first rule in the above figure would read as follows:

 if
     all of the following conditions are true:
         the State of residence of the customer is New York
         the age of the customer is at most 20
Split Columns

Conditions or actions can be split across more than one column of the table when the rule statement they represent contains more than one value. For example, the following condition requires you to specify a value for both <min> and <max>:

 if
       the age of the customer age is between <min> and <max>

In a decision table, this condition is represented in the Age column, but across 2 subcolumns, one for the value <min> and one for the value <max>:

images/dtable_column_split1.png

Changing the Operator

You can merge or split the cells under subcolumns and change the operator. For example, the third row in the following table also deals with Age, but with the operator is more than (which has one value) instead of is between (which requires two):

images/dtable_column_split2.png

How to merge or split columns and change the operator is explained in section Split Columns and Changing the Operator.

Rows and Cells

Each row of a decision table corresponds to one rule:

images/dtable_row_split0.png

To make the rows of decision tables more intuitive to read, cells that are shared by more than 1 rule are merged:

images/dtable_row_split1.png

In this table, both rules have the same value for the first condition but a different value for the second condition, as follows:

A third rule added to this decision table can either:

images/dtable_row_split3.png

images/dtable_row_split2.png

Also, you can add an `Otherwise' row to take into account the case where none of the other possibilities for that condition are correct.

How to add a rows depending on the context is explained in section Inserting & Removing Rows.

Partitioned Cells

Groups of cells that are in the same condition column and have a common cell immediately to the left are referred to as partitions.

Partitions are important to consider when adding new rows (Inserting & Removing Rows) and when sorting columns (Organizing Rows and Columns).

Partitions let you easily pick out any missing or redundant rules in your tables:

images/dtable_partitions.png

In a decision table, each cell in the left-most column represents the first condition to be considered. Then, for each of these cells, the next column should contain a group of cells (partition) that cover all possible values for that column. If it does not, the table may be incomplete.

Similarly, if there are additional columns, the same rule applies: the third column should contain groups of cells that cover all possible values for that column.

Empty Cells

It is possible for a row to contain empty cells:

images/dtable_row_empty.png

The fourth rule would simply not consider the second action.

See Also

Preconditions