For details on working with the rule language see TIBCO BusinessEvents Language Reference for details about working with the rule language.To open the rule editor select a rule in the project panel, or double-click a rule in an open rule set.The rule editor includes three panels, the Declaration panel, the Conditions panel, and the Actions panel, explained next.Drag and drop the resources that you will be using in your rule into this area, or click the plus sign and select resources. This defines the scope of the rule.Declaring multiple terms of the same type allows the rule to consider multiple instances of the corresponding Entity.
Scorecards Scorecards are like concepts except that there is only one instance of a scorecard (or more accurately, one instance per agent when multi-engine features are used). It is therefore not necessary to put scorecards in the declaration because a scorecard never requires an alias. You can use scorecard properties in conditions (just as you would concept properties).Write condition statements in this area. 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.
The order in which conditions are evaluated is determined internally by the engine (see Understanding Conflict Resolution and Run to Completion Cycles). To enforce the order of evaluation between two or more conditions, put them on the same line (that is, in one statement ending in a semicolon) joined by the logical operator &&.Be aware of some differences in execution when you combine conditions. For example, consider these two conditions:A null pointer exception may be thrown if concept.containedConcept is null, because the second condition can be checked before the first.concept.containedConcept != null && concept.containedConcept.property == "test";A null pointer exception is not thrown if concept.containedConcept is null:Write action statements in this area. BusinessEvents executes these actions when there is a set of objects in working memory that matches all the conditions, and the rule is at the top of the rule agenda.To use a global variable in the rule editor, use one of the System.getGlobalVariableAs* functions. For example:System.getGlobalVariableAsString("Hostname", "Localhost")Where Hostname is the name of the variable and Localhost is an optional literal value to use if the variable is not found.For information on additional procedures for using mapper functions (which are decorated with a small m when viewed in the function catalog) see Using XSLT Mapper Functions.
− Type the function name, including catalog folders but not the catalog name, for example Database.beginTrace().
− In the function registry, click on the name of a catalog, for example, fx Standard. Drill down on categories within the catalog to expand to lists of functions and drag the desired function to the Condition or Actions area.
2. Provide parameter values as indicated by the tooltip. You can hover the cursor over a function to display a tooltip showing the function’s syntax. You can also see the tooltip contents in the online reference, TIBCO BusinessEvents Functions Reference.See Understanding and Working With Functions for descriptions of the various function catalogs, and an explanation of the decorations that appear on many function names.When you drag a mapper function or type the name of a mapper function into the Actions or Conditions areas, then type an open parenthesis ( "(" ) BusinessEvents displays <<xslt-template>>, which is a link to the mapper.
1. Click on the link (<<xslt-template>>)to open the mapper:
2. Click the browse icon () to the right of the Entity Path field to display a list of resources of the appropriate type for the function.
3. Select a resource and click Apply.
4. Select the Input tab. BusinessEvents displays a list of variables associated with the project on the left and a list of properties for the selected resource on the right.
7. Click OK.
Inside the mapper, indexes for property arrays start with one (1). In the BusinessEvents language, indexes for property arrays start with zero (0).The rule editor has its own search utility, which allows you to search for text within the Condition and Action areas. You can search for any text or limit your search to functions. When you select a rule or ruleset resource, a search button () appears on the main toolbar. Click the button to bring up the Search For Text dialog:
Drill down and then double-click on an item in the list of results to highlight that text in the rule editor.
This feature is also available in other BusinessEvents resources, for example, BAR resources. The behavior is the same.You can add the AdvisoryEvent event type to a rule declaration. You might do this in order to track certain types of exceptions.To add an advisory event to a rule, click the plus icon () in the Declarations panel and select Advisory Event from the list of resources.
See Chapter 5, Working With Advisory Events for more details.
Copyright © TIBCO Software Inc. All Rights Reserved.