Adding the InitializeScorecard Rule Function

You will add a rule function, which is written in the TIBCO BusinessEvents rule language.

    Procedure
  1. Right-click the RuleFunctions folder, and select New > Rule Function.
    You will see the New Rule Function Wizard.
  2. In the Rule Function name field, type InitializeScorecard.
    In the Description field, type Sets values in the FraudCriteria scorecard.
  3. Click Finish.
    You can work in the Source view or the Form view, according to your preference. The tutorial uses the Form view. In the lower area, click the Form tab to switch to the Form view.

    Tip:
    Rule Function Editor Preference
     To set the default mode, go to Window > Preferences > TIBCO BusinessEvents > Rules and check or uncheck the following checkbox as desired: Initially show "Form" tab in Rule Function Editor.

    Ctrl-click the name of a rule function in a rule or rule function editor to open the editor for that rule function.

  4. Leave the Scope area empty, because this function is used at startup. In the Body area, add the following lines to provide values to the FraudCriteria scorecard (and to comment your code):
    //Initialize scorecard variables
    FraudCriteria.debits_percent =.8;
    FraudCriteria.interval       = 120*1000; /* 120 seconds */
    FraudCriteria.num_txns = 3;

    Notice that when you type the period after FraudCriteria, a list of its properties appears so you can select a property.

  5. Save and close the resource.
What to do next

You’ve set up a startup rule function. Next you’ll set up an event preprocessor rule function.