Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 16 Rules and Rule Functions : Adding a Rule Function

Adding a Rule Function
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.
To Add a Rule Function
See Rule Function Resource Reference for details on completing values.
1.
a.
b.
c.
Set the return type for the rule function. Default is void. Browse to select a return type as needed. For return types that require additional configuration, such as ContainedConcept, complete the configuration in the Rule Function editor.
d.
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 > TIBCO 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 section, 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.
5.
6.
Action (validity=ACTION)
Action and Condition (validity=CONDITION)
Virtual rule functions have a non-editable validity setting of Action.
7.
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.)
Virtual rule functions have a non-editable return type of Void.
8.
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 BusinessEvents 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.
c.
If you want to specify an array, check the isArray checkbox. (You can specify a variable array in the source editor in the usual way, for example, int[] myArr.)
d.
e.
Your selection appears in the list. TIBCO BusinessEvents assigns an alias to it. You can edit the alias.
Add more entities as needed.
9.
10.
In the Body section (Body statements in the source editor), use the TIBCO 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.
11.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved