This topic explains how to use the Decision Table Editor, which you use to edit decision table files that have the .sbdt
extension. The Decision Table Editor can only open, edit, and save decision tables of this type.
Use the Decision Table Editor to create and edit decision tables for your EventFlow application. Open the Editor in one of two ways:
-
Double-click an existing decision table file with the
.sbdt
extension in the Project Explorer view forproject name
> > > . -
Specify the
.sbdt
file type when creating new, empty decision table as described in the next section.
To create an .sbdt
decision table file, use the following steps:
-
Start from the Decision Table Settings tab of a Decision Table operator's Properties view.
-
Leave the file name field empty and click the Decision Table File link. Studio then opens the New StreamBase Decision Table wizard to help you create a new file.
-
By default your project folder is selected and expanded to
project name
> > > (the file must reside in the Resources folder). Enter the name for the decision table file and select the file type:-
On Windows or on a Mac, you can select the
.sbdt
file type. In this case, clicking opens the Decision Table Editor in Studio that allows you to create a decision table, row by row, then save it to the file name you specified. The.sbdt
file type is recommended as it is also supported by the Decision Table Analyzer, which can be used to troubleshoot your table. -
On Windows only, you can also select the
.xlsx
file type. -
Alternatively, you can invoke File> > from Studio's top-level menu.
-
-
Click
. Configure the Conditions and Action Schema properties with the names and types of your decision table's condition and action fields. Notice that you can only configure standard condition and action columns in this dialog. To add StreamBase condition and action columns, continue creating the table, then add those in the Decision Table Editor. -
Click
, which opens the Decision Table Editor, showing a blank decision table. If you specified condition and action columns in page two of the wizard, then those column names and data types appear, but no rules yet exist. -
From the Decision Table Editor, click the
button to add rows, one row for each rule. Enter data as needed into the Condition and Action columns. - to include additional (standard, BusinessEvents syntax) actions or conditions, or StreamBase conditions or actions. Standard and StreamBase condition and action columns are described in
-
Enter an optional Effective Date. This opens the Date and Time Picker that allows you to select a date and time from a calendar interface.
Note
Setting an effective date for the future generates a warning message.
-
Enter an optional date for when the decision table expires.
In addition to using the Date and Time Picker dialog, both date fields support the following formats entered directly:
-
yyyy-MM-dd HH:mm:ss.SSSZ
-
yyyy-MM-dd HH:mm:ss (time zone is set to local time zone)
-
yyyy-MM-dd HH:mm (seconds is set to 00, and timezone is set to local time zone)
-
yyyy-MM-dd (hours/minutes/seconds are all set to 00, and timezone is set to local time zone)
Note
StreamBase prevents decision tables from loading when either the expiration date is less than or equal to the effective date (that is, the rules will never be active), or when the expiration date is set to the past (rules will never be active).
-
-
Skip the table priority option. It is currently not supported, as a single Decision Table operator does not support loading multiple decision tables.
-
Decide whether to select the check box that specifies single row rule execution mode. When enabled, the first rule runs that matches the input causes the operator to emit its output tuple. When disabled, all rules are run against each input tuple.
-
To set the priority for individual rules, select a rule ID and click the Rule Priority's up or down arrow as needed {1 highest, 10 lowest. Default: 0}. Rows with higher priorities are executed before those with lower priorities, as follows:
-
First, all conditions are checked for all rows that have the highest priority. (The checking order within a set of rows with the same priority is not determinate.)
-
Then the rule actions for all of those rows whose conditions evaluate to true are executed. (The execution order is not determinate. Runtime optimizes rule execution.)
-
The process is repeated for all rows with the next highest priority, and so on.
-
-
Enter your rule information into each cell as required. See Conditions and Actions in Decision Tables for syntax guidance.
Note
For boolean data types, a three-state check box represents boolean fields for both conditions and actions. Click the check box to cycle through the states as required {check mark for true, minus sign for false, blank for unset}.
The following example shows five rules populated:
Use the following buttons in the Decision Table Editor to build rules:
Button | Description | |
---|---|---|
Add Row | Adds rows, incrementing rule IDs per row. Choose:
|
|
Remove Row | Removes rows. Deleted corresponding rule IDs do not reset numbering for next added row unless decision table preferences are configured to do so. See Decision Table Panel. | |
Add Column | Adds a new Action or Condition column. Choose:
|
|
Fit Content | Fits all columns to cell contents. | |
Merge Rows | The merge rows functionality is an alternative way to present the rows and cells of the decision table. The merge does not actually change anything. Rather, it combines equal conditions so that they appear as one condition that spans multiple rows. This is helpful to see more of a tree-like view of the decision table's contents. More importantly, it allows you to change equal cells once and have that change reflected in all merged rows. For example, if you have the condition > 10 && < 20 that spans ten rows, changing that condition by merging rows will change that condition for all ten rows. If Merge Rows is off, you must change that condition in all ten rows. You can also use the Merge Rows button as a toggle: to toggle between merged and unmerged rows, click the | button again.|
Show Filter | Click John Doe in the name column, for example), and another column B (25 in the age column) to show only rows with one value for B.
|
to display a row above the first rule. You can filter on multiple columns. For example, you might enter text in the filter
row to filter column A to show only rows with one value for A (|
Duplicate Rule | This adds a new row with the same conditions and actions, but with a different ID. You can then edit the row as needed. | |
Show Text | Displays full syntax for each cell. |
From your Decision Table project folder, double-click an .sbdt
file to invoke the Decision Table Editor. Right-click the following objects in the decision table to change their properties:
Object | Option |
---|---|
row |
Enable or disable the rule in the selected row. |
cell |
|
column title cell |
Remove column Move:
Field Settings. See The Field Settings Dialog. Auto resize column |
non-title cell |
Add comment Disable Auto resize column |
Use the Field Settings Dialog to edit features of your condition and action columns. Right-click a column to:
-
Specify the column name. For non-StreamBase columns, the name must match the name of a field in the incoming tuple. For StreamBase columns, the name can be any string not yet used in this decision table.
-
Set the column type. For standard non-StreamBase columns, you can select from a drop-down list that includes: bool, double, int, list, long, string, timestamp, tuple. For StreamBase columns, the type is restricted to a StreamBase expression.
Domain models restrict the set of values that can be placed in a condition or action cell. By default, a cell has no restrictions.
Domain model files are used at authoring time to provide down-downs for fields governed by domain models; they do not affect the Decision Table operator's runtime behavior.
The StreamBase Decision Table operator can optionally use a JSON-formatted file to define one or more domain models. The Decision Table operator's Domain Model File property points to a domain model file, if available. Below is an example of an domain model file containing three arrays:
[ { 'name': 'Names', 'field': 'Name', 'isConditionField': 'true', 'isActionField': 'false', 'isMultiSelect': 'false', 'values': ['Jim', 'Frank', 'Steve'] }, { 'name': 'Ages', 'field': 'Age', 'isConditionField': 'true', 'isActionField': 'false', 'isMultiSelect': 'false', 'values': ['5', '10', '> 15 && < 20'] }, { 'name': 'Statuses', 'field': 'Status', 'isConditionField': 'false', 'isActionField': 'true', 'isMultiSelect': 'false', 'values': ['Good', 'Bad', 'Indifferent'] } ]
The JSON
file consists of an array of elements that specifies the name of the domain model name, the name of the condition and/or
action fields to which it applies, whether a condition field is multi-select (the TIBCO StreamBase® Add-in for Microsoft Excel
does not use a drop-down to select values for multi-select fields), and the actual values available for the particular field.
-
From StreamBase Studio, select the
JSON
file to load when the Decision Table operator starts and run the EventFlow Table application. Domain model files must reside in theproject name
> > > folder. -
Start a supported version of Microsoft Excel in which you have installed the Add-in.
-
In the Excel Add-in, open the
.xlsx
decision table that the running EventFlow application is using.Note
Only
.xlsx
decision tables currently supported domain models. -
From the Excel Add-in, download the
JSON
file into your decision table and make changes as needed. -
From the Excel Add-in, upload the decision table to the StreamBase server in-memory.
-
From StreamBase Studio, test your changes by entering data into the InputStream.