You can create a ruleflow in Rule
Designer, and add elements to your ruleflow
in the Ruleflow Editor. You use these elements to determine a sequence in which the rules are
selected, and define which methods the rule engine uses to evaluate those rules.
About this task
You can add a ruleflow to a project, or any of its packages. You can have multiple ruleflows in
a project, but if you have more than one ruleflow in a project, you must define one of them as the
main ruleflow. After adding a ruleflow to a rule project or package, you define the structure by
adding the elements that you need in the ruleflow diagram. To understand the use of each element,
see Ruleflows. Then, you connect
these elements by adding transitions between them.
Procedure
- In the Rule Explorer, select the name of the package or project you want to add a ruleflow to,
and click
New Ruleflow on the New Rule Project Item toolbar. In the New Ruleflow dialog that opens, enter the relevant information for
your ruleflow. If you are adding the ruleflow to a package, make sure the name of this package is
added in the Package field. No entry is needed for a ruleflow created under
the top folder.
- To set the ruleflow as main, click in an empty area of
the ruleflow diagram, and click the Properties tab
of the Properties view. Set the main
flow task property to true.
- Use the buttons in the Ruleflow Editor palette to add elements in the ruleflow diagram as
required. You must create one start node for your ruleflow, and at least one end node.
- Create rule tasks, and add rules to be executed at this point in the ruleflow.
- Add a rule task element in the diagram.
- Set the properties that you need in the Properties view. For more
information about rule tasks properties, see Configuring ruleflow properties.
- In the Rule Selection tab of the Properties view,
click Edit to open the Select Rules dialog, and add
rules to a rule task. You can use the Up and Down
buttons to order the rules and packages. Depending on the rule execution properties of the task,
this order might impact the output of ruleflow execution.
Tip: You can also drag an existing rule package or rule from the Rule Explorer into the
ruleflow diagram. The rule task has the name of the element and already contains the rules and
packages.
- Optional: If you need to execute rule action statements, add action tasks in your ruleflow, and set the
action statement, initial action, and final action in the Properties
view.
- Add transitions between the tasks to define the flow of your ruleflow.
- To specify a condition for the transition, in the Properties view for
the transition, click Condition.
- Provide a name for the condition in the Label field.
- Select Use BAL for transition condition and type a condition statement.
For example:
'the current rental agreement' is accepted
You can also write the condition using IRL. In this case, make sure the text fields contain a
valid Boolean expression. If you do not use BAL, in the ruleflow diagram the transition arrow
displays the label and the expression.
In transition conditions, the variable scope is restricted to ruleset parameters and variables.
It does not include access to the working memory.
- Optional: You can create multiple, parallel paths in your ruleflow, if you need to
execute rules simultaneously. For example, if you are checking the eligibility of a customer for a
loan, you might want to check whether the customer meets the criteria for the loan, and also if the
amount requested is valid. To do so, you use forks and joins in your ruleflow.
- Add a fork node where you want your ruleflow to execute several rules in parallel. You can then
add your rule tasks in the ruleflow.
- Add a join where you want to combine the transitions created from the fork. Make sure to create
all transitions between the different elements.
The transitions from a fork node to a join node must not have conditions, because the ruleflow
follows all paths in parallel between the fork and the join.
- Optional: You can add branches to the ruleflow to organize conditional transitions, in the same way that
you could start several conditional transitions from a task.
Important: When multiple transitions originating from a branch or a task define overlapping conditions, the
path taken to execute the ruleflow is unpredictable. Make sure the conditions you define for
multiple transitions do not overlap.
- Add a branch node where you want your ruleflow to organize the different conditions.
- To name the branch, in the ruleflow diagram click the branch icon and in the
Properties view, click Branch Node and enter the name
in the field provided.
- Add transitions to and from the branch.
- Add transition conditions for each transition from the branch. One of the transitions must be
an Else transition.
- Optional: If you want to execute another ruleflow at some point in your main ruleflow, add a subflow task
in the diagram:
- In the Properties view for the subflow task, click Subflow
Task.
- Click Select to select a ruleflow to include in the subflow task.
- To align the ruleflow automatically, click
Layout All Nodes in the Ruleflow Editor toolbar. You can also align items
manually by selecting them, right-click the ruleflow, and select Align.
Select the alignment options in the pop-up menu that opens.
- Save the ruleflow (Ctrl+S).