Building Rules for Decision Table Artifacts


Table of Contents
Overview
Building Rules Using the Artifact Editor
Managing Rules Using the Schema Editor
Changing the Artifact Editor's Appearance

Overview

Once a decision table artifact is available for editing, you build rules for the artifact with the Artifact Editor using business rules syntax.

The Artifact Editor supports the following rule building methods:

  • Adding action and action columns directly from the Artifact Editor

  • Using the Edit Schema button to manage the artifact's rules

  • Clicking the Options button the Text Editor to edit the artifacts properties

To build rules, you must select an artifact from the Workspace view and enable it for editing by checking it out. Once checked out, the artifact's state becomes working, which indicates it is available for editing.

  • If you created the artifact, it is checked out by default.

  • For non-checked out artifacts, right-click the artifact to invoke the Checkout menu, or click Check Out from the Artifact Editor if the artifact is displayed there.

General Artifact Editor Buttons

ButtonDescription
Content/MetadataToggles between the content editor and the metadata editor.
SaveSaves local changes.
CommitCommit local changes.
VerifyVerifies the artifact
Undo/RedoUndo and reapplies most recent changes.

Artifact Editor Option Buttons

The Options button displays the following options.

ButtonDescription
Switch toSwitch to text editor or metadata editor.
DeleteDeletes the artifact if it is not already in the repository. If the artifact is in the repository, you can recover it. However, your local changes are lost.
Discard Local ChangesAllows you to specify which artifacts you want to discard. Discard essentially "un-checks out" artifacts. Your changes are not saved.
CommitAllows you to specify which artifacts you want to commit to the AMS repository. A user with reviewer privileges is notified of the pending commit.
Lock/UnlockArtifacts can be in one of two states: locked or unlocked. Locked prevents other users from editing the artifact; unlocked (default) allows others users to edit the artifact. Admin users can force an unlock of any artifact.
Replace With
  • Upload File: Allows you to browse to an external location and select a file whose contents overwrite that of the file in the repository to an external location, select a file, and swap with the file currently in the repository.

  • Latest Revision: Replaces your working copy with the latest available revision, as stored in the repository.

  • Older Revision: Allows you to replace the current artifact with an older revision.

HistoryDisplays the project history for the specified artifacts.
Deployment
  • Deploy: Allows you to deploy the artifact to a running decision table or model operator in a running StreamBase application. Note: StreamBase Studio is typically used for authoring applications. Although StreamBase applications can be run from Studio, they need not be run from Studio. See Artifact Deployment Overview.

  • Deployment History: Displays a record of all deployments for the selected artifact.

  • Manage Descriptors: Displays the descriptors used to deploy the selected artifact and allows new descriptors for that artifact to be created.

More
  • Info: Displays the artifact path, project folder, and the option to view the artifact's content.

  • Download: Downloads the artifact to your local file system (for example, to a supported EventFlow module in StreamBase Studio).

Building Rules Using the Artifact Editor

  1. With your artifact displayed in the Artifact Editor, click Add Column, one column for each condition or action you want to build into your business rules.

    1. Enter a column name.

    2. Select a column type from the drop-down list. Choose from StreamBase or standard (TIBCO BusinessEvents) syntax to build your condition and action rules. See Decision Table Syntax for Building Rules for syntax usage:

      • Condition

      • Action

      • StreamBase Condition

      • StreamBase Action

    3. Select a property type:

      • bool

      • double

      • int

      • list

      • long

      • string

      • timestamp

  2. Click Add Row, once for each business rule that you want to build.

    1. Enter your rule information into each cell as required, depending on the column's data type. See Decision Table Syntax for Building Rules for syntax guidance. If using the boolean data type, double-click in the cell to toggle between true and false.

    2. Optionally, set the rule priority (the order in which rules fire) by double-clicking in the cell and selecting a priority level from the drop-down list {1 highest, 10 lowest. Default: blank, which equates to 5}.

  3. Enter an optional date and time for when the artifact becomes effective (once it is ultimately loaded into a StreamBase decision table EventFlow module).

  4. Enter an optional date and time for when the artifact expires, using one of the following formats:

    1. YYYY-MM-DD hh:mm-hh:mm

    2. YYYY-MM-DD HH:mm:ss.SSSZ

    3. YYYY-MM-DD HH:mm:ss (time zone is set to local time zone)

    4. YYYY-MM-DD HH:mm (seconds are set to 00, and timezone is set to local time zone)

    5. YYYY-MM-DD (hours/minutes/seconds are all set to 00, and timezone is set to local time zone)

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

  6. Enable single row rule execution as needed. When enabled, the first run rule that matches the input causes the TIBCO StreamBase Decision Table EventFlow module (when the artifact is deployed to the module) to emit its (StreamBase) output tuple. When disabled, all rules are run against each input tuple, prioritized in descending order by rule ID. For more information about the Decision Table operator, see the Decision Table operator documentation page in the StreamBase Authoring Guide, in the TIBCO Streaming® documentation.

  7. The following example shows a simple artifact containing five rules and four columns (two condition and two action columns):

  8. Press Ctrl+S (Windows), command+S (Mac), or click Save. Changes are saved locally and are not yet visible to other users. If you click Commit, AMS sends your artifact changes to the reviewer for approval. Changes remain pending until the reviewer accepts or rejects them. Once the reviewer acts upon the commit, you receive notification in the Notifications view.

Copying and Pasting Rules

In many cases it is simply easier and more convenient to copy, paste, and edit a rule than it is to build a new one. AMS supports copying and pasting as follows.

Copy

Key combo: Ctrl+C or command+C (Mac) to copy the selected cell (or cells when multiple are selected) to the clipboard.

Right-click on a cell and select Copy: copy the selected cell (or cells when multiple are selected) to the clipboard.

Right-click on a cell and select Copy Row: copy the whole row on which the selected cell resides to the clipboard.

Right-click on a cell and select Copy Row with header: copy the whole row on which the selected cell resides, plus the header of the table to the clipboard.

Paste

Key combo: Ctrl+V (command+V on Mac) to paste from the clipboard to the selected cell.

Right-click on a cell and select Paste: this prompts a dialog instructing you use Ctrl+V.

Paste multiple cells/rows: when multiple cells/rows are in the clipboard and were pasted, AMS tries to paste them all with the same layout of the original cells/rows, until it runs out of range.

Managing Rules Using the Schema Editor

The schema editor offers a streamlined and often more efficient method for editing artifact rules. From the schema editor, you can manage fields (condition and action columns) and build rules using rules syntax as required.

Use the schema editor to manage StreamBase decision table artifacts. The editor does not currently support Decision table artifacts based on TIBCO BusinessEvents syntax.

The following example shows an artifact named DecisionTable and containing one condition column and one action column.

  1. With your artifact displayed in the Artifact Editor, click Edit Schema.

  2. Clicking Add field will add a new condition or action column, depending on which side you click the button in the schema editor.

  3. Choose Simple or Expression from the drop-down list.

  4. Once you are done making changes in the schema editor, click Save. This action refreshes the artifact in the Artifact Editor but does not save the artifact itself.

  5. From the Artifact Editor, press Ctrl+S (Windows), command+S (Mac), or click Save to save the artifact. Changes are saved locally and are not yet visible to other users. If you click Commit, AMS sends your artifact changes to the reviewer for approval. Changes remain pending until the reviewer accepts or rejects them. Once the reviewer acts upon the commit, you receive notification in the Notifications view.

Changing the Artifact Editor's Appearance

You can set how the Artifact Editor displays business rules. Click the Change Look and Feel menu and select one of the display options.