Adding a Virtual Rule Function

Procedure

  1. Right-click the folder where you want to store the virtual rule function and select New > Rule Function. You see the New Rule Function Wizard.
    1. In the Rule Function Name field, type a name for the rule function.
    2. 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).
    3. Check the Virtual checkbox.
      Note: You cannot change a new resource name after you click Finish. (You can change the description, however.)
  2. Click Finish.

    Click the 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. These instructions use the form editor and mention the equivalent settings in the source editor.

  3. 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).
  4. If you did not do so in the Wizard, check the Virtual check box.
    Tip: In the source editor, the signature of a virtual rule function is:
       virtual void rulefunction folder.RFName
    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.

    In virtual rule functions, the Validity field is set to Action and the Return Type is set to Void. column, select where the rule function can be used (source editor equivalents shown in parentheses:

  5. In the Scope section (scope statements in the source editor), drag an ontology entity into the Scope area, OR do the following:
    1. Click Add to add resources that you will be using in your rule function. You see the Select Rule Function Scope Arguments dialog.
    2. In the upper half of the Select Rule Function Scope Arguments dialog, select the type you want to use.
    3. If the type you select is an ontology type, in the lower half of the dialog, select a resource from the filtered ontology tree.
    4. Click OK.

      Your selection appears in the Declarations list. TIBCO BusinessEvents assigns an alias to it. You can edit the alias.

      Add more entities as needed.

  6. Save the project.

Result

For example, here is the source view for a simple virtual rule function:

/**
 * @description Action to take when account is suspended
 */
virtual void rulefunction Rules.FollowUp {
  attribute {
    validity = ACTION;
  }
  scope {
    Concepts.Account account;
  }
  body {
  }
}