Runtime rule selection
You specify the rules selected at run time in the Rule Selection tab of the Properties view. You can select individual rules, or packages containing several rules, that are considered for execution in this rule task, and filter out some of them. You can specify this filter with dynamic BAL constructs or IRL. The filter is applied at run time, and the rule engine runs only the rules that pass through the filter. If you use the Fastpath algorithm, the conditions of the other rules might also be evaluated.
An empty list of rules and packages means that all the rules from the project are selected for execution at run time.
Selecting rules with BAL
Typically, the filtering process is based on the values of rule properties and execution parameters. The filter tests each rule in the ruleflow task to determine whether the rule should be selected for execution. For example, the following code filters on the name of the rule and is called for every rule in the task.
the name of 'the rule' contains "Age"
You can further refine runtime rule selection by using specific BAL
constructs such as is, is over, is under, to
define hierarchical relationships between the rules (see Hierarchies).
The filter is evaluated each time the rule task is invoked. Candidate rules can be selected based on the ruleset parameter state. For example, you can specify that the expiry date of the rule is after the date of the loan.
Selecting rules with IRL
Select rules directly in IRL by using the dynamicselect keyword:
body = dynamicselect(?rule) { <Optional Statements> return <boolean expression>; }
The example shows that a body of the rule task can be an IRL predicate that selects the relevant rules among all the rules of the ruleset.
In the following example, the specification selects all the rules available in the ruleset:
body = dynamicselect(?rule) { return true; }