Adding a Rule
Procedure
- In BusinessEvents Studio Explorer, right-click the folder where you want to store the rule and select New > Rule. You see the New Rule Wizard.
- In the Rule Name field, type a name for the rule. In the Description field, type a description as desired. (In the source editor the description appears in the @description line of the comments at the top of the editor.)
-
Click
Finish. By default, you see the source rule editor on opening the editor. It shows the outline for a rule’s source code. Click the
Form tab at the bottom of the editor to use the form editor.
At any time you can click the Form and Source tabs at the bottom of the editor to switch between the form-based editor and the source editor as you work, depending on your preference.
- In the Form editor Configuration section, add or edit a description as desired. (In the source editor the description appears in the * @description line of the comments at the top of the editor.)
-
To control the order of rule execution:
-
If you want to control the order in which rules execute, set the
Priority field accordingly. Highest priority is 1. (In the source editor set
priority =
n where n is the priority number.)
If you want to also control the order in which rules with the same priority execute, set the Rank field accordingly. Browse to and select the rule function you created for this purpose. (If you want to use the source editor, add Rank=RuleFunction in the list of rule attributes.) See Using Priority and Rank to Control Order of Rule Execution for details.
-
If you want to control the order in which rules execute, set the
Priority field accordingly. Highest priority is 1. (In the source editor set
priority =
n where n is the priority number.)
- To disable forward rule chaining (the default behavior) uncheck the Forward Chain check box. (In the source editor set forwardChain = false.)
-
In the Declarations section (equivalent to the
declare statements in the source editor), drag an ontology entity into the section, or perform the following actions.
- Click Add to add resources that you will be using in your rule. You see the Select Rule Declaration Arguments dialog.
- In the upper half of the Select Rule Declaration Arguments dialog, select the kind of entity you want to use.
- In the lower half of the dialog, select a resource from the filtered ontology tree, and click OK. Your selection appears in the Declarations list. TIBCO BusinessEvents assigns an alias to the resource. You can edit the alias.
-
To re-order the declarations, highlight a declaration and click the up or down arrow to move it. This is relevant only in rule functions, to order the arguments.
Repeat to add more entity types as desired.
-
In the Conditions section (equivalent to the
when statements in the source editor), write condition statements (in the TIBCO BusinessEvents rule language).
Each line is a complete statement. Each condition must evaluate to a Boolean value. Each line is joined to the others with an implicit AND operator. All of a rule’s conditions must evaluate to true for the conditions to be satisfied. Refer to the "Order of Evaluation of Rule Conditions" section in TIBCO BusinessEvents Architect’s Guide for more information.
See Using Variables and Functions in the Rule Editor for more information on working in the rule editor.
- In the Actions section (equivalent to the then statements in the source editor), write action statements (in the TIBCO BusinessEvents rules language).
- Save the resource.