As rule applications grow very large, it may become increasingly difficult to identify where rule execution will start and where it will end, especially when the application is analyzed by someone other than the primary author(s).
Rule flows in InRule provide the ability to diagram a specific, high-level sequence of branching conditions and subsequent actions for rule execution. Rule flows provide for the graphical representation of an explicit, single-pass sequential RuleSet, which may contain one or more of the following elements of a rule application in a prescribed order for execution:
Creating a new Rule Flow
- Click on the Rule Flows icon in the left-hand navigation
- Click the Add Rule Flow button. The following screen will appear:
- Select the appropriate entity context within which the Rule Flow will operate.
- The Rule Flow designer will be displayed with a default Rule Flow:
Converting a Rule Set to a Rule Flow
A rule flow can be created from an existing rule set. Right-click on the rule set and choose the To Rule Flow option. In order to be able to convert a rule set to a rule flow, the rule set will be validated to ensure it can be converted. In addition to some other validations, the rule set must satisfy the following criteria:
- The RuleSet has a Fire Mode setting of explicit
- The RuleSet has only If/Then/Else conditions
- The RuleSet has only the Execute RuleSet or Execute Workflow actions
Authoring a Rule Flow
A Rule Flow generally consists of an entry point, one or more exit points, conditions, and actions.
Rule Flow Elements
Elements must be dragged onto the designer from the Flow Elements container:
Condition Element
The condition element permits branching of the Rule Flow based on a value's TRUE/FALSE outcome. To define the condition, click on the pencil icon of the condition shape.
The syntax condition editor will be displayed as follows:
Hover over the condition element to display the TRUE/FALSE port labels.
Convergence Element
The convergence element is used to join two upstream rule flow branches into one. Convergence is useful in a situation where two separate upstream rule flow branches need to intersect back into the same sequential flow. To use the convergence element, drag it onto the canvas and connect two upstream connectors into the top port of the element as follows:
RuleSet Element
The RuleSet element represents an explicit rule set defined elsewhere in the rule application.
A Rule Flow can be defined to include RuleSet elements from any entity context of the rule application schema. RuleSet elements can also be defined for independent rule sets from the rule application.
To define which RuleSet the element represents, click on the arrow shape and select the RuleSet from the menu:
Clicking the magnifying glass icon inside the element will auto-navigate to the selected RuleSet.
The Edit option, available from the right-click menu, allows users to edit parameters already in the Target RuleSet.
Member RuleSet
The Member RuleSet element represents an explicit RuleSet defined at the member level of a collection elsewhere in the rule application. A Rule Flow can be defined to include Member RuleSet elements from any collection member context of the rule application schema.
To define which Member RuleSet the element represents, right-click on the element after dragging onto the design field and selecting Edit.
RuleFlow Element
A Rule Flow can be defined to include the execution of other Rule Flows.
To define which Rule Flow the element represents, click on the arrow shape and select the Rule Flow from the menu:
Clicking the pencil icon inside the element will open the selected Rule Flow.
WorkFlow Element
A Rule Flow can be defined to include the execution of workflows defined for the rule application.
To define which Workflow endpoint the element represents, click on the pencil icon to open the Workflow definition dialog:
Termination Element
All Rule Flow branches must stop at a Termination element. A default termination exists as part of every Rule Flow. Additional termination elements can be dragged onto the Rule Flow designer.
Connecting Rule Flow Elements and Default Behavior
Elements of a Rule Flow must be connected together in a logical beginning-to-end sequence in order for the rule flow to be compiled without error and executed.
To connect elements
- Drag an element onto the designer.
- Hover over the upstream element to display a small box that represents the port of the connector. In this simple example, the upstream element is the default entry element.
- Click on the port and drag the connector to the downstream element. Hover over the downstream element until its port is displayed.
- Release and the element are connected. In this simple example, the new element is automatically connected downstream to the default terminator element.
General Behavior Connecting Elements
- In a single branch flow, the most downstream element will automatically connect itself to the default terminator.
- As each additional element is connected into a single-path flow, the designer will attempt to terminate the default downstream connector accordingly.
- Elements that do not have an upstream connection are considered orphans. Orphans will result in compilation errors.
- Dashed lines indicate that the element connected is not represented by a Def in the irSDK object model.
Converging and Terminating Rule Flows
Single Path Flows
A flow with no conditions has only a single path for execution. Single path flows can terminate at the default termination element as well as at a termination element dragged onto the rule flow.
Flows With Multiple Branches or Paths
Using one or more condition elements will result in a branching flow that, based on entity values, will execute different downstream rule flow elements. The user may experience InRule validation errors when attempting to terminate rule flows with conditions if they do not follow these rules:
- As a general guideline, InRule requires that convergence shapes be one-to-one with condition shapes unless the condition terminates at a separate, non-default termination element. For example, each branch of the condition element must either connect downstream to a non-default termination element or connect into a convergence element prior to the branch ending at the default termination element.
The following sample rule flows represent VALID handling of convergence and termination.
Invalid Convergence / Termination Handling
The following situations will result in rule flow validation errors:
- Neither branch of a condition element ends at a termination
- The branches of a condition element terminate at different convergence elements
- Either branch terminates at an invalid element (e.g. any element other than a convergence or termination)
Rule Flow Menu Options, Zoom controls, and Undo Behavior
Rule Flow Designer Options
Right-click on the designer to open the options menu:
- Print - Allows the user to print or preview the rule flow. The rule flow can also be restricted to print on one page.
- Export Image - Saves the rule flow as an image.
- Auto Layout - Adjusts the rule flow elements in a logical layout.
Rule Flow Element Options
Right-click on an element to open the following menu:
To select multiple elements:
- Lasso the desired elements
- Hold Ctrl and click elements
- Hold Shift and click elements
The align options will use the first element selected as the guide for which other elements are aligned against
Zoom controls
- Dragging elements beyond the default defined boundaries increases the designer's size.
- The zoom slider control increases or decreases the area viewable in the designer.
Undo Behavior
All work performed inside the Rule Flow designer can be undone or redone using the Ctrl+Z / Ctrl+Y shortcut key combinations or the menu options.
Comments
0 comments
Please sign in to leave a comment.