Decision Table Introduction

This topic explains what decision tables are and how to construct one that accurately reflects your enterprise's business rules.

Overview

Decision tables provide a way to build complex business rules, by defining threshold value conditions and actions in the cells of the table.

Each row can be thought of as single rule in a table made up of many rules. The individual rules are often straightforward, as shown in the examples below. When built into an EventFlow application, the Decision Table operator allows you to to run your decision table against incoming tuples.

Conditions and Actions in Decision Tables

A decision table is made up of columns where where each column represents one condition or one action.

A condition is a predicate test that must evaluate to true for the associated action to be executed. If a decision table rule uses multiple conditions, all conditions for a row must evaluate to true for the action to execute. Condition tests might be looking to match the exact value of an incoming field's value, or might be comparing an incoming value for whether it is greater than, less than, greater than or equal to, or less than or equal to a specified value.

In each rule's row, you define the specific conditions and actions that comprise that rule. For example, if a condition column is Age (comparing to an incoming tuple field of that name), then each row can define a different age range. The action for each row would define what action to take if an incoming tuple contains an Age value within the specified range.

If you add a second condition column called Name, then before the action is taken, the Decision Table operator tests both conditions to see if both the incoming Age and Name field values are within the ranges specified in the rules.

StreamBase decision tables support:

  • Custom Condition Columns that supports StreamBase expressions, including most StreamBase expression language functions, and supports data in the scope of the function at runtime. A condition column can also contain complex formulas.

  • Custom Action Columns that support StreamBase expressions and functions, plus data in the scope of the function at runtime. It can also contain complex formulas.

The Decision Table operator supports two types of expression syntax for condition and action columns: StreamBase expression or TIBCO BusinessEvents expression syntax. When editing decision tables with the Decision Table Editor, and you click the Add Column button, you can specify whether to add a Condition or Action column (which use BusinessEvents syntax) or a Custom Condition or Custom Action column (which use StreamBase syntax).

StreamBase Custom Condition Column Features:

  • Column is not necessarily associated with a specific field in the incoming tuple.

  • Cell content contains full StreamBase expressions that resolve to a boolean value.

  • Cell content can reference other fields in the incoming tuple.

  • String literals must be enclosed in double quotes.

BusinessEvents Condition Column Features:

  • Column is associated with a specific field in the incoming tuple, the field with the same name as the column.

  • Left side of cell expression is derived from the field associated with the column. For example, "< 10" becomes "FieldName < 10"

  • Cell content cannot reference other fields in the incoming tuple.

  • Cell content in string columns need not be enclosed in double quotes.

StreamBase Custom Action Column Features:

  • Column is associated with a specific field in the outgoing action tuple.

  • Cell content can contain full StreamBase expressions that must evaluate to the type of the corresponding action tuple field.

  • Cell content can reference incoming tuple fields.

  • String literals must be enclosed in double quotes.

BusinessEvents Action Column Features:

  • Column is associated with a specific field in the outgoing action tuple.

  • Cell content is interpreted as a literal value.

  • Cell content cannot reference incoming tuple fields.

  • Cell content in string columns need not be enclosed in double quotes.

Summary of Decision Table File Types

The Decision Table File property of the Decision Table operator can load three decision table file types into the operator, with four different origins, as shown in the following table:

File Type Extension Origin
StreamBase format decision table .sbdt Edited in and saved from the Decision Table Editor in StreamBase Studio.
Excel format decision table .xlsx Edited in and saved from Microsoft Excel on Windows with the StreamBase Excel Add-in installed.
Edited in and saved from Microsoft Excel on Windows, with the BusinessEvents Excel Add-in installed. StreamBase Studio can import and use these files and the StreamBase Excel Add-in can edit them.
TIBCO BusinessEvents native decision table format .rulefunctionimpl Edited in and saved from TIBCO BusinessEvents. StreamBase Studio can import these files, but cannot edit them.

Debugging Limitation

When using EventFlow debugging, stepping into or over a Decision Table operator is not supported. However, you can still set breakpoints anywhere downstream of such operators. If you are stopped at a breakpoint on an arc feeding a Decision Table operator, you must resume to get across the operator.

For debugging a Decision Table operator, consider using the features of the Decision Table Analyzer's Show Coverage feature to get a debug-like view of how the operator responds to different input tuples.