March 04

BRF+ Function (Event Mode Scenario)

In this blog, Let’s try to create a BRF+ Function with Event mode.


A function is the rule interface in BRFplus and acts as a link between the application code and the BRFplus code.

A function carries a modecontext and a result. It imports the context from the calling application and passes the context data to the assigned top expression or ruleset for further processing. After processing, the function returns the calculated result to the calling application. To create function from scratch, follow the Creating a Function.

  1. Mode (Event mode)
  2. Context
  3. Result



A ruleset is a collection of rules to be processed in a particular business case. It serves as an entry point for rule processing and can be used as an alternative to a top expression assigned to a function.

The mode of operation setting of the assigned function must be either Event Mode or Functional and Event Mode.


Here, I have designed a scenario to calculate actual price of item using event mode (ruleset), following are the steps:

  1. Find the base price
  2. Apply State Tax
  3. Apply Central Tax
  4. Find the Festive season
  5. If transaction date falls in festive season, apply festival discount


Decision Table:

A decision table expression is used to compare a given input against a list of predefined combinations of conditions. Each combination has an individual result assigned which is returned as the expression result when the input data matches the particular combination.

Here the combinations are,

  • Gold
  • Silver

Calculating the basic price using the expression,

Table settings are shown below:


Including 18% of state tax with the basic price using the below Formula expression,

Including 18% of Central tax with the base price (after inclusion of state tax),


Finding the month from current date using the below Formula expression (Using standard date function DT_PART_MONTHS)

Based on the month, check whether it is festival season based using Boolean expression:

As an example, I have taken December and January as festival months. i.e., Festival discount will be applicable for transactions performed in them:

Finally calculating the final price,

  • If the current purchase date falls in festive months then 50% discount will be applied to the final price (after central tax).
  • If the current purchase date is not falling in festive months then the result will give the final price (after central tax).