Regular rule functions have arguments and a body containing the code for the function. Virtual rule functions have arguments but no body. Virtual rule functions are used only with the TIBCO BusinessEvents Decision Manager add-on software. The implementation for virtual rule functions is provided by one or more decision tables. See TIBCO BusinessEvents Decision Manager product documentation for more details.See Rule Function Resource Reference for details on completing values.
1. In Studio Explorer, right click the folder where you want to store the rule function and select New > Rule Function. You see the New Rule Function Wizard.
b. In the Description field, type a description. (In the source editor the description appears in the * @description line of the comments at the top of the editor).
c. If you want this rule function to be a virtual rule function (to be implemented by a decision table), check the Virtual checkbox.
You can’t change the name in the editor. To change the name of any project element, right-click the element in Studio Explorer and select Refactor > Rename. See Chapter 4, Element Refactoring Operations for more details.
2. Click Finish. If you see the source editor, click the Form tab at the bottom of the editor to use the form editor as desired.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.
Rule Function Editor Preference To set which mode the editor uses upon first opening, go to Window > Preferences > BusinessEvents > Rules and check or uncheck the following checkbox as desired: Initially show ’Form’ tab in Rule Function Editor.
3. In the Form editor Configuration panel, add or edit an alias and a description as desired. (In the source editor the description appears in the * @description line of the comments at the top of the editor and the Alias appears in the attribute list.).
4. If you did not do so in the Wizard, set the Virtual check box according to your need. Check the check box if you are creating a virtual rule function (to be implemented by a Decision Manager decision table).
Do not add code to the Body block in the source editor of a virtual rule function. If you do, you see error messages if you try to save or to switch to the form-based editor.
5. From the Validity drop-down list, select the value that specifies where the rule function can be used (source editor attribute equivalents shown in parentheses):
− Action (validity=ACTION)
− Action and Condition (validity=CONDITION)
− Action, Condition and Query (validity=QUERY)
6. If the rule function returns a value, specify the Return Type, otherwise leave this field set to void. (Appears in the signature of the rule function in the Source editor.)
7. In the Scope section (scope statements in the source editor) you define the arguments of the rule function. Drag entities into the Scope area from Studio Explorer, OR do the following:
a. Click Add to add resources that you will be using in your rule function. You see the Select Rule Function Scope Arguments dialog.
b. In the upper half of the Select Rule Function Scope Arguments dialog, select the type you want to use.
c. If the type you select is an ontology type, in the lower half of the dialog, select a resource from the filtered ontology tree.
d. Click OK.
8. Add more arguments as needed, and use the up and down arrows to order the arguments as needed.
9. In the Body panel (Body statements in the source editor), use the BusinessEvents rule language to implement the function. (Virtual rule functions have only a signature, and no implementation at design time.)See Using Variables and Functions in the Rule Editor and Tips for Working in the Rule Editor for more information on working in the rule editor.
Copyright © TIBCO Software Inc. All Rights Reserved.