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 the .sbdt extension in the Project Explorer view for project namesrcmainresources.

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

Creating a 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.

  3. By default your project folder is selected and expanded to project namesrcmainresources (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 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. 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 FileNewStreamBase Decision Table from Studio's top-level menu.

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

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

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

  7. Click Add Column to include additional (standard, 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.

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

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

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

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

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

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

Decision Table Configuration Options

Use the following buttons in the Decision Table Editor to build rules:

Button Description
Add Row Adds rows, incrementing rule IDs per row. Choose:
  • Add Row Above Selection

  • Add Row Below Selection

  • Add Row To The Beginning

  • Add Row To The End

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:
  • 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 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
  • Add Comment

  • Unset cell's value

  • 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 Field Settings Dialog.

Auto resize column

non-title cell

Add comment

Disable

Auto resize column

The Field Settings Dialog

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.

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. Domain model files must reside in the project namesrcmainresources folder.

  • Launch the Excel Add-in and open the 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 Domain Model File field, click Choose or use the drop-down arrow.

  2. Select an available JSON file and click OK.