Decision Table Editor

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.

Using the Decision Table Editor

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 .sbdt extension in the Package Explorer view.

  • Specify the .sbdt file type when creating new, empty decision table as described in the next section.

Creating an .sbdt Decision Table File

To create an .sbdt decision table file, use the following steps:

  1. Start from the Decision Table Settings tab of a Decision Table operator's Properties view.

  2. 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. Select the project name, enter the name for your decision table file, and select the type of file:

    • On Windows or on a Mac, you can select the .sbdt file type. In this case, clicking Finish 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.

    • On Windows only, you can select the .xlsx or .xls file type. The use and editing of this file type is described on other pages.

  3. As an alternative to the above steps, you can invoke FileNewStreamBase Decision Table from Studio's top-level menu.

  4. From either starting point, the New StreamBase Decision Table dialog appears. Enter a file name and select the .sbdt Decision Table Format.

  5. Click Next. 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.

  6. Click Finish, 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.

  7. From the Decision Table Editor, click the Add Row button to add rows, one row for each rule. Enter data as needed into the Condition and Action columns.

  8. Click Add Column to include additional (standard, or BusinessEvents syntax) actions or conditions, or StreamBase conditions or actions. Standard and StreamBase condition and action columns are described in Conditions and Actions in Decision Tables.

    Note

    If you select the timestamp Element Type, double-click in the column's cells to open the Date and Time Picker dialog.

  9. Enter an optional Effective Date. This opens the Date and Time Picker dialog.

    Note

    Setting an effective date for the future generates a warning message.

  10. 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:

    1. yyyy-MM-dd HH:mm:ss.SSSZ

    2. yyyy-MM-dd HH:mm:ss (time zone is set to local time zone)

    3. yyyy-MM-dd HH:mm (seconds is set to 00, and timezone is set to local time zone)

    4. 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).

  11. Select the table priority from the drop-down list {1 highest, 10 lowest. Default: 5}.

  12. 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.

  13. Decide whether to set a 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}.

  14. Enter your rule information into each cell as required. See Conditions and Actions in Decision Tables for syntax guidance.

    Note

    For boolean data types in BusinessEvents Action expressions only, 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:

Decision Table Configuration Options

The Decision Table Editor has the following buttons:

Button Description
Add Row Adds rows, incrementing rule IDs per row.
Remove Row Removes rows. Deleted corresponding rule IDs do not automatically reset numbering for next added row. To reset row numbers, right-click the ID block in the Decision Table Editor.
Add Column Adds a new Action or Condition column. Choose:
  • Add Condition — for a standard condition column type

  • Add Action — for a standard action column type

  • Add StreamBase Condition — for a condition column type that accepts StreamBase expressions

  • Add StreamBase Action — for a action column type that accepts StreamBase expressions

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 Merge Rows button again.
Show Filter Click Show Filter 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 (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.
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.

Editing .sbdt Decision Table Files

From your Decision Table project folder, double-click an .sbdt file to open 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 that row.

cell
  • Add Comment

  • Enable or disable cell's conditions

  • Auto resize column

column title cell

Remove column

Move:

  • Move to the beginning

  • Move to the left

  • Move to the right

  • Move to the end

Field Settings (see the next section)

  • Edit column name

  • Enter alias

  • Default expression (works if one is already available when decision table was created, cannot enter one manually)

Auto resize column

non-title cell
  • Add Comment

  • Disable

  • Auto resize column

Field Settings Dialog

Use the Field Settings dialog to edit features of your decision table's condition and action columns. Invoke the Field Settings dialog by right-clicking 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 element (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.

  • Optionally, in the dialog click the List Type check box to mark a column type as List.

Understanding Domain Models

Domain models restrict the set of values that can be placed in a condition or action cell. By default, a cell has no restrictions. The StreamBase Decision Table operator can optionally uses 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, the name of the condition and/or action fields to which it applies, whether a condition field is multi-select (the Excel Add-in does not use a drop-down to select values for multi-select fields), and the actual values available for the particular field.

Domain Model Workflow

  • From StreamBase Studio, select the JSON file to load when the Decision Table operator starts and run the EventFlow Table application.

  • Start a supported version of Microsoft Excel in which you have installed the TIBCO StreamBase® Add-in for Microsoft Excel.

  • 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.

Domain model files are used at authoring time to provide down-downs for fields governed by domain models; they don't affect the Decision Table operator's run time behavior.

Selecting a Domain Model

Domain Models must be available in the application's resource search path. To select a file, do the following:

  1. From the Click the Domain Model File field, click Choose... or use the drop-down arrow.

  2. Select an available JSON file and click OK.