Each business rule in InterSystems IRIS is part of a rule set. In turn, each rule set is part of a larger rule definition. Sometimes, the terms rule and rule definition are used interchangeably, but each individual rule is ultimately grouped under a rule definition.
Rule definitions, rules sets, and rules are edited using the Rule Editor, which is accessed in the Management Portal by navigating to Interoperability > Build > Business Rules.
You can open existing rules in the Rule Editor by navigating to Interoperability > List > Business Rules.
About Rule Definitions
Individual business rules are group under a rule definition, which is built and edited using the Rule Editor. A rule definition includes the following settings:
Package for the rule definition class.
Name of the rule definition class.
User-specified description of the rule definition and its purpose.
Type of rule definition, which determines valid actions when defining rules that belong to the rule definition.
Class that determines which object properties you can modify when you edit a rule. For general business rules, the context class is generated from the business process class associated with the BPL process and ends in .Context. For routing rules that are not associated with a BPL process, the context class is usually the business process class used by the routing engine.
When creating the rule definition, you can use the Filters options to shrink the list of classes that appears in the Context Class drop-down list.
(Optional) For routing rules, provides the name of the production where the rule will be used so the Rule Editor can offer predefined options when editing the rule. For example, if you specify a production and then modify a constraint, the configuration items in the production appear as options for the Source field of the constraint.
The routing rule is not automatically used in the production unless you specify the rule when you configure the production.
Exporting and Importing Rules
A rule definition, including its rule sets and rules, can be exported by navigating to Interoperability > List > Business Rules, and selecting Export. You can import a previously exported rule definition using the Import option.
Alternatively, you can also export and import rule classes from the System Explorer > Globals page of the Management Portal or the Tools menu in Studio as well.
About Rule Sets
When you create a new rule definition, a new rule set is created automatically. To define the rule set name and effective date range, or to create new rules sets, select the icon next to the rule set name.
In general, there are two types of rule sets:
General business rule sets — A list of rules that are evaluated sequentially until one of them is found to be true. The rule that is found to be true determines the next action of the business process that invoked the rule. If none of the rules are true, the rule set returns a default value. You invoke this type of rule set using the BPL <rule> element.
Routing rule sets — A rule set for use in message routing productions. Based on the types and contents of incoming messages (which you specify as constraints), the routing rule set determines the correct destination for each message and how to transform the message contents prior to transmission. You use a routing engine business process to invoke this type of rule set.
All rule sets have two properties:
Rule Set Name — Identifier for the rule set.
Effective Range — Defines the time during which the rule set is effective, that is, when its rules will be executed.
Typically, a rule definition includes only one rule set that is always in effect. However, a rule definition can include multiple rule sets as long as they are in effect at different times. Each time a business process invokes a rule, one and only one rule set is executed.