Rule/Flow Sets
  • Updated on 08 Mar 2019
  • 6 minutes to read
  • Print
  • Dark
    Light

Rule/Flow Sets

  • Print
  • Dark
    Light

Flow andRule Sets are a common set of rules and flows that can be parameterized or customized based on context without the need to copy or rewrite them. The Rule Set allows you to define a number of rules or flows that can work together. These define the process that you would like to follow that will be known as the base set.
Once a Rule Set is defined in the base set, a subset can be created. This allows a change in the process to be added to a group of Flows and Rules without the need to recreate each item. The subset has the ability to alter input data, which rules are applied, and which processing elements should remain. The process will stay the same, but the context of each subset can be modified for the situation.

An example of this would be through an Auto Insurance processing company . By defining a base flow set, you can set the process of how you would like to approve insurance applications and apply rules to the data. However, with a large company, there may be a difference in how you would like to approve the application. For example, the application approval requirements may differ depending on owner’s car specifications. Although the main flow approving process is the same, you can specify the subset and change some of the context.

Here is an example of how to create a flow set:

Note : in order to use Rule Sets and Interceptor Rules , Decisions.FlowSets Module should be installed. To learn how to install Module in Decisions please click here .

After Flow Sets Module is installed, create Application Structure to use in the Rule Set . In the Designer Folder, createFlow Structure from Datatypes/Database > User Defined Types on Folder Actions Panel.
2018-08-29_143116.jpg

In the resulting window, Name our structure and tab through to add data members and their type to the structure.
When all desirable Data Members added, select SAVE to save the structure.
Note: The Birthday structure member is of a Date type.

2018-05-08_152956-1.jpg

Next, in the Designer Folder from All Folder Actions, selectCreate Rule > Create Rule/Flow Set .
In the resulting dialog, Name the Rule Set and select CREATE .

2018-05-08_153240-1.jpg

A Sub Folder for the Rule Set is created by the System in the Designer Folder .  Navigate to this Folder .
In the Rule Set Folder , select Setup Rule Set on the Folder Actions Panel.

2018-05-08_153307-1.jpg

In the Edit Flow Template Data window we make the following configurations…
Usage:
Logical – apply logical check to data. Best used for validations and data check.
Data Return – best use for data manipulations.
Scoring – used for statistical purposes when need to do manipulations on the rule results count.
Run Mode:
Run All – run all Rules/Flows in the Set
Stop On First True – terminate Set execution on first Rule evaluating as True
Stop On First False - terminate Set execution on first Rule evaluating as False
Style:
Template w/ Instances – used when we want to create a base Set of Rules and then create specific sub-sets of Rules.
Instance – used when we want to create just a Set of Rules without specific sub-sets.
In theInputs Setup, define Rule Set Inputs . These Inputs will be passed into each Rule/Flow in the Set . Select Add New link to add an Input .

2018-05-08_153829-1.jpg

In theAdd Inputs window,  Name the Input and pick a Type of the PolicyApplication Structure that was created previously in this tutorial. 
There are multiple Data Inputs to add.  MinIncome (Decimal), MaxIncome(Decimal), olderThan(TimeSpan), and youngerThan(TimeSpan).  Next set the Rule Set Type to Template w/ Instances.
When the Rule Set is configured select SAVE to save it.
2018-05-08_154039-1.jpg

Next, start creating Rules for the Set .
From the Folder Action Panel select Add Rule > Evaluation .
There are two types of Rules that can be created in Rule Set : Evaluation and Action . If data needs to be validated or checked (apply logic) use Evaluation type; If data needs to be manipulated or changed – use Action type.

2018-05-08_154215-1.jpg

In the resulting window name the Rule and select Create Rule .

2018-05-08_154252-1.jpg

The Rule has Application input by default. Build the Rule Phrase using Application properties. In this case build a Rule to check if applicant is currently insured.
2018-05-08_154342-1.jpg

The first Rule looks as following:
2018-05-08_154406-1.jpg

The logic for this Rule is next:
2018-05-08_154656-1.jpg

Use the Rule input of older than to Configure Offset for Compute Date.
2018-05-08_155134-1.jpg

And this Rule design completed.
2018-05-08_155212-1.jpg

Next, create Denial Rule that looks as following:
2018-05-08_155435-1.jpg

Again, use an additional Rule input (youngerThan) for Computing Date .
2018-05-08_155620-1.jpg

Because the Rule Set is configured to be a Template w/ Instances , add Instances of this template. In the Instance create additional (specific) Rules. Select Create Instance button on the Folder Actions Panel in Rule Set Folder.
2018-05-08_155748-1.jpg

In the resulting dialog, Name the Instance and select CREATE . System creates an Instance Sub Folder.
2018-05-08_155838-1.jpg

For this example create two Instances : Policy A and Policy B . Navigate to thePolicy B instance.
2018-05-08_155935-1.jpg

For this instance all base Rules will be ran automatically.  Application is an input by default. Create an Evaluation Rule for this Instance .
2018-05-08_160323-2.jpg

This Instance will be specific because this Rule will define additional requirements and data validation. Design a Rule that checks vehicle horse power and four wheel drive capability.
2018-05-08_160434-1.jpg

The Rule Set is completed now. Close it and navigate to the Designer Folder and build a Flow to test this Rule Set.
In the Designer Folder, select Create Flow from the Folder Actions Panel.
Then, Name the Flow and select Create to proceed to the Flow Designer .
2018-05-08_160650-1.jpg

In the Flow Designer add Run Rule Set step from Flows, Rules, Forms and Reports > Rules category and connect its outcome to the End step in the Flow .
2018-05-08_160812-1.jpg

The Rule Set will require an Application to Evaluate, create an Application as an input to the Flow . Select Start step on the workspace and select Add New link in the Inputs section.
2018-05-08_160901-2.jpg

As described, Name our Input Data and define its type of PolicyApplication .
2018-05-08_161015-1.jpg

Next, select Run Rule Set step on the workspace.  In the step Properties > Rule Set chose the Pick link and select the created template, PolicyRuleSet.
2018-05-08_161132-1.jpg

Next, Navigate to the PolicyB instance folder.  Select Manage > Get Rule Set ID.
2018-05-08_161610-1.jpg

Copy the ID from the popup.
2018-05-08_162356-1.jpg

Back in theRuleSetFlow, with the RuleSet Step selected, navigate to Properties > Rule Flow Set ID. Set to Constant and paste the copied ID.
2018-05-09_093310-1.jpg

This completes the Flow . Select Debug Flow link on the top panel of the Flow Designer to test the Flow .
2018-05-08_163217-1.jpg

In the Create New Session window, select the Input Data selector.
2018-05-08_163255-1.jpg

In the resulting window populate Application fields with data and select Ok .
2018-05-08_163451-1.jpg

Next, select Run
Flow executes in the Debugger with no issues. Confirm that Run Rule/Flow Set step outputs PolicyRuleSet evaluation results for each Rule in the Set .
2018-05-09_093631-1.jpg

Was this article helpful?