Add composite rules
Composite rules define a Business Process (BP) flow variant, depending on the Record column values.
For example, a rule can be like this: if the website_status of a record is VALID, execute the Rename the Company Contact Information task for the record. Otherwise, go to End. The figure below is how the rule-associated workflow would look.

A composite rule does not contain any business logic but is used to route the output to the rest of the BP elements based on the decision. For information on rule-based bot steps with a complex logic, see Add rule-based bot steps.
Add rule to Business Process
You can add a composite rule to a BP on the Workflow tab using one of the following methods:
Drag the diamond element from the toolbar, or click the canvas to open the context menu and choose Add rule. In this case, a blank rule is created.

In the panel on the right, navigate to the Rule tab and drag a rule to the canvas. Alternatively, click a rule element in the flow to open the context menu and choose Duplicate. In this case, a rule is copied from the source rule. You can edit it if needed.

Configure rule
You can configure a rule in one of the following ways:
Via Rule editor
To open Rule editor, double-click a rule element (diamond) in the canvas or right-click the element and choose Edit.

On the Rule Editor page, proceed as follows:
Enter a unique name for your rule.
Click Add Outcome if there is none. Each rule must have at least one outcome.
Click Add Condition to add a condition to an outcome.
You can add multiple conditions to one Outcome. If you leave Outcome without any conditions, this means all other Records.
The logic of rule elements is as follows:
- AND between Conditions
- OR between Outcomes
Set the conditions for your outcomes. Each condition contains three required fields:
- Answer Code, or the column name in the data file. The field is auto completed.
- Logical Operator, for instance, equals, less than.
- Value, or a regular expression (matches regexp, not matches regexp). RegExp allows you to use the OR logic in the condition values by adding the pipe
|symbol, for instance,1|2.
Save the rule by clicking Save.
Connect the newly created outcomes to the target tasks or processes.
To apply additional settings related to composite rules, open advanced rule options and advanced outcome options.
Via Code Editor
Alternatively, to create a custom rule logic, switch to the Code Editor mode and edit the rule source code in the Drools language.

See sample rule code
package com.freedomoss.requester;
# list any import classes here.
import java.util.Map;
import java.util.ArrayList;
import com.freedomoss.objective.model.CompositeRuleContext;
import com.freedomoss.objective.model.CompositeRuleDataItemContext;
import org.slf4j.Logger;
# declare any global variables here
global CompositeRuleContext source
global Logger log
global Map params
# RuleContext.SPIT_RULE:usa
rule "Rule context initialization"
auto-focus true
no-loop
agenda-group "initialization-group"
when
$ctx:CompositeRuleContext(initialized == false);
then
# insert processed facts into memory
$ctx.updateWorkingMemory();
# move to business rules
kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup("calculation").setFocus();
end
# RuleOutcome.Definition={"outcomeId":"Group I","conditional":false,"conditions":[]}
# RuleOutcome.Definition={"outcomeId":"Group II","conditional":false,"conditions":[]}
# RuleOutcome.Definition={"outcomeId":"Group III","conditional":false,"conditions":[]}
# RuleOutcome.Definition={"outcomeId":"Group IV","conditional":false,"conditions":[]}
# RuleOutcome.Definition={"outcomeId":"Group V","conditional":false,"conditions":[]}
# RuleOutcome.Definition={"outcomeId":"outcome1","conditional":false,"conditions":[]}
rule "Send unprocessed result to unconditional outcome(s)"
agenda-group "calculation"
dialect "mvel"
salience 80
when
$ctx:CompositeRuleContext(initialized == true);
$item:CompositeRuleDataItemContext();
then
$ctx.sendResultToUnconditionalOutcomes($item, true);
$ctx.logExecutedRule(kcontext.getRule().getName() + " item:" + $item.toString());
end
rule "Logging all items"
agenda-group "calculation"
dialect "mvel"
salience 60
when
$ctx:CompositeRuleContext(initialized == true);
$item:CompositeRuleDataItemContext(this memberOf $ctx.lastStepDataItems);
then
$ctx.logExecutedRule(kcontext.getRule().getName() + " item:" + $item.toString());
end
Modify rule
To edit a rule, double-click the rule element (diamond) or right-click it and select Edit from the context menu. Then, make necessary changes to the configured settings.

Set advanced rule options
APPROVE_ALL_RULE
If you checked the rule, the Drools execution is replaced with a Java loop that unconditionally sends all records to the next step.
SPLIT_DATA
The flag enables splitting records for the next step according to the number of created tasks.
To split a single record into multiple ones, create a composite rule with the SPLIT_DATA flag after a Bot Task using the multi-column export plugin (with split-results="true").
To minimize data errors when data record splitting is required, avoid adding the SPLIT_DATA rule after the step that splits records in its export section.
SPLIT_RULE and JOIN_RULE
The flags are used in BPs where all records going to the fork have to pass through all branches and join afterward. The step after the JOIN rule won't start until all branches are completed.
A group label—the value inserted after a flag—is used to differentiate between split-join groups in case they are used more than once, for example, if a BP has sub-processes with the split and join operations.

STREAMING
The flag overrides BP streaming settings for the subsequent step. If set, it defines the number of tasks or a percentage value for streaming.

NAMED_RULE
The flag is used to build cut-off rules in a BP according to model results. The rule is used after the extract step and allows you to generate a condition automatically.
Set advanced outcome options
The Enable logging feature under the advanced outcome options is obsolete.
There is only one advanced outcome option—Enable logging. If you apply it, the rule execution is recorded to rules.log.