Show TOC

Background documentationRuleset

 

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.

Features

Function Assignment

For a ruleset to be processed, a function has to be assigned to the ruleset. The mode of operation setting of the assigned function must be either Event Mode or Functional and Event Mode. A ruleset can be assigned to only one function, whereas one function may have any number of rulesets assigned.

If a function has more than one ruleset assigned, the question arises how you can influence the execution order of the different rulesets. To control the execution order, you can assign a priority to a ruleset that is evaluated at runtime when the assigned function is executed. To set the ruleset priority, open the Detail section and enter the desired value (from 00 to 99) in the Priority field. For more information, see Function, section Ruleset Execution Priority.

Note Note

In the BRFplus workbench, the Where used function does not yield a result for rulesets. However, in the Ruleset Header section you can find out easily to which function a particular ruleset is assigned.

In previous releases of BRFplus, it was also possible to have each single rule assigned to a function as its trigger, rather than assigning the function to the ruleset. This is no longer supported. However, if you have legacy applications that make use of the individual assignment of rules and functions, the system is still able to process such rules.

End of the note.
Rule Assignment

The rules contained in a ruleset can be either named or unnamed:

  • Named rules are references to rule objects that you have defined in your BRFplus application. Such rules are stand-alone objects and can be reused by different rulesets.

  • Unnamed rules are defined in the scope of a particular ruleset and are not accessible for other objects. Unnamed rules may either contain a reference to a named rule or an immediate definition of the tasks to perform.

    Note Note

    When you create a rule from inside a ruleset and enter a text in the Description field, this rule still counts as an unnamed object. The system copies the text that you enter in the rule-specific Description field of the ruleset to the Text field of the rule object, while the rule's Name field remains empty.

    End of the note.

In addition to the trigger function, a ruleset also defines the precondition and validity period for each rule. The precondition and validity period determine if the rule is triggered or not. Given that, the system provides numerous conditional levels to determine whether the activities defined in a rule are to be carried out or not:

  • Assigned function is called.

  • Ruleset is enabled.

  • Ruleset precondition is fulfilled.

  • Preceding ruleset exit conditions are not fulfilled.

  • Ruleset-specific rule precondition is fulfilled.

  • Rule is enabled.

  • Current date and time falls into the rule validity period.

  • Precondition for an activity defined in the rule is fulfilled.

Variables

If you need to exchange additional data between the function assigned to a ruleset and the rules inside of the ruleset, you can extend the ruleset's signature by adding variables to it. You can use any of the data objects available in the application as variables. Inside of the ruleset, the variables are treated very much like context elements and can therefore be accessed by most of the context-related actions like Assign Value to Context or Initialize Context. The near relationship between context data and variables is also illustrated by the fact that for a ruleset, the Context Overview function displays not only the context data objects of the assigned functions but also the ruleset variables.

Note Note

Although variables can be used similarly to context data objects, it is not possible to define a ruleset precondition based on variables. For a ruleset precondition, it is mandatory to refer to context data objects. In contrast to this, it is perfectly allowed to define a ruleset exit condition based on variables.

End of the note.
Deferred Ruleset Processing

As described above, you can define exit conditions for a ruleset that let you stop ruleset processing at a defined point in the process flow if a condition is fulfilled. The default behavior here is that all data changes that were applied during processing of the preceding rules are kept in the system, while any potential changes that would result from processing the remaining rules are of course missing. Depending on the circumstances of a given business case, this may lead to data inconsistencies.

To overcome this potential problem, you can define that a ruleset may be restarted at the point where processing stopped in a previous run. With this option set, you can continue an interrupted processing run, which helps you to complete the data changes that result from the rule processing. This is helpful in cases where the exit conditions that you define for a ruleset are likely to be fulfilled in your particular business case, that is, when a fulfilled exit condition is the rule rather than the exception.

Example Example

You have a ruleset defined to calculate the energy fees for the apartment owners in an apartment building. However, not all of the apartment owners send the electricity meter count in due time. In this situation, you can start a ruleset to calculate the energy fees for those apartments for which the meter count is already known. However, if there are additional rules in the ruleset for a statistical analysis of the building's energy consumption based on the apartment data, these rules require a complete set of input data.

With deferred ruleset processing, you would place an exit condition before the statistics rules to check whether all required data is available. If not, ruleset execution stops here but can be restarted at a later point in time when all the required data is available, so that the remaining rules can be processed.

End of the example.

To enable deferred ruleset processing for a BRFplus application, proceed as follows:

  1. Navigate to the application to which the ruleset belongs.

  2. On the Miscellaneous tab, choose Restart Rulesets Enabled.

Once you have gone through these preparatory steps at application level, you can start using the additional features that are available for deferred ruleset processing. You can access these features in the BRFplus workbench in the form of additional settings for exit conditions in a ruleset.

Note Note

For a complete understanding of the deferred ruleset processing concept, it is important to be aware of the following facts:

  • Deferred processing can be controlled on application level only for all rulesets belonging to an application. It is not possible to control deferred processing for selected rulesets in an application.

  • Using deferred processing is possible only via appropriate program calls to the BRFplus API. There is no support for interactive use of this feature in the BRFplus workbench UI.

  • Deferred processing is supported via the following API objects:

    Name

    Use

    IF_FDT_RS_INTERRUPT_HANDLER

    Provides methods to retrieve system interrupts created by the system when a ruleset exit condition was fulfilled.

    CL_FDT_RS_INTERRUPT_HANDLER

    Implements interface IF_FDT_RS_INTERRUPT_HANDLER.

    IF_FDT_RS_INTERRUPT

    Provides methods to save an interrupt instance to the database, to restart the associated ruleset, and to delete a saved interrupt from the database.

End of the note.