Setting Up Rule Set
- Updated on 12 Oct 2016
- 7 minutes to read
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 .
This tutorial demonstrates how to set up a Rule Set in Decisions 4.0.
Rule/Flow Set is a set of Rules and Flows in Decisions that is targeted to work together in a process of complex data evaluation. Rule Sets give the best flexibility in data validation. This document describes the key options and functionalities available with Rule Sets in Decisions 4.0.
In this example we are going to demonstrate how to create a Rule Set , overview Rule Set Settings , and use a simple Rule Set in the Workflow process.
First, we are going to create a simple Flow Structure to use as an input for our Rule Set.
In the Designer Folder we click Datatypes/Database > User Defined Types > Flow Structure on Folder Actions Panel.
Then, in the Flow Structure definition window we provide Structure Type Name and add 4 Data Members: FirstName, LastName, State, andAge. When finished, we click Ok to save and continue.
To create a Rule Set in the Designer Folder we click Create Rule > Create Rule/Flow Set Action on Folder Actions Panel.
In the resulting window we Name Rule/Flow Set and click Ok .
System creates a Rule/Flow Set Base Folder . On the Rule/Flow Set View of this Folder we can see Rule/Flow Set Settings on the left-hand side and Rules and Flows in Set on the right-hand side of the Page . To edit our Rule Set Settings we click Setup Rule Set on Folder Actions Panel.
Setup Rule Set window pops up… The first section of settings is Rule Set Data where we can define our Rule Set Inputs . The data that we define here will be required as a Step input for our Rule Set in the Flow Designer . Also, this data will be available across all Rules and Flows in this Set . We click Add New link to add new Rule Set Input Data.
In the Input Data definition window we Name our Input Data and pick ApplicationFlowStructure Type that we created previously in this tutorial. Then, click Ok to save and continue.
The next section of Settings is Setup .
In Usage category we can pick how do we want to use our Rule Set:
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 category defines default execution mode for the Rule Set :
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 .
Rule Set Type category defines a style for our Rule Set:
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.
Conditional – Rule Set Type that allows to create Rule Sets within this Rule Set. In the Conditional Rule Set we can use Flows to Extend Data Inputs for Flows/Rules based on the designed conditions or create Run Set Rule controls to determine if we need to run the Set based on designed conditions.
In the Advanced sub-category we can set if we want to:
- Show Messages for Expired or Disabled Items.
- Run Invalid Flows-Rules.
- Stop Processing on Exception.
- If we use Conditional Rule Set Type we can set Instance Create Name.
Next settings section is Rule Types . In this section we are able to set what Tools will be available in our Rule Set:
Flows – Evaluation : to build a custom Flow that evaluates data and outputs ResultData .
Flows – Evaluation/Data Addition: to build a custom Flow that evaluates data and outputs ResultData and Rule Set Input Data.
Flows – Transform Data: to build a custom Flow for editing Rule Set Input Data.
Action Rules: to be able to use Rules that trigger different Flows based on the designed conditions.
Truth Tables: to use Truth Tables for more complex data validations.
- Allow Interceptor Rules: to build Rules that intercept and stop invalid data from being processed.
- Intercepted Flow: to build handlers for intercepted data.
Next, Outcome Options section. In this section we can set up the outcome scenarios for the Rule Set step in the Flow Designer.
Show All Truth Path – creating an outcome path that the Flow takes if all Rules in the Set evaluated ‘True’.
Show All False Path – creating an outcome path that the Flow takes if all Rules in the Set evaluated ‘False’.
Path For No Rule Result – default outcome Path that is used when Rule Set execution is completed.
Defined Outcome Paths – custom outcome Paths that may be used to continue Flow Execution on the desirable Flow Branch based on the Rule Set Results.
Done Path Name – to customize default ‘Done’ outcome name.
Lists – to be able to output more information for the Advanced Reporting and Logging:
- Output Error List
- Output False List
- Output No Result List
- Output Not Run List
- Output True List
Next section is Data Storage . In this section we can define what data from the Rule Set Execution do we need to save and may define Result Extension Type.
Note: if we use Interceptor Rules , all intercepted data will be stored even if we do not set any Data Storage options.
Result Data Storage options:
In the API section we can set if we want to Allow REST API Calls or Create Web Service for this Rule Set.
When we finished setting up our Rule Set we can click Ok to save and continue.
Next, we are going to add couple simple Rules to our Rule Set.
In the Rule Set Folder we click Add Evaluation Rule on Folder Actions Panel.
In the resulting window we Name the Rule and click Ok to proceed to the Rule Designer.
In the Rule Designer we click Add New Rule Step button on the Start Rule window.
Then, we pick Age data member from our ApplicationData Rule Input and click Next .
On the verb definition for our Rule Phrase we pick Greater Than and click Next .
For the value we define Constant ‘21’ and click Done .
Our Rule should read ‘ApplicationData Greater Than 21’ . This completes our Rule . We can save the Rule and close Rule Designer.
Next, in the similar manner we add another Evaluation Rule that reads***‘ApplicationData is NC’*** .
Finally, we are going to demonstrate how to use our simple Rule Set in the Workflow .
In the Designer Folder we click Create Flow on the Folder Actions Panel.
Then, we Name the Flow and click Ok to proceed to the Flow Designer.
First, in the Flow Designer we are going to create an instance of our ApplicationFlowStructure Type . We add Create Data step from the Favorite Steps category.
Next, in the Create Data step we define our ApplicationFlowStructure Application Data .
On the outcome from Create Data step we add Run Rule Set step from Flows, Rules, Forms and Reports > Rules category.
In the Run Rule Set step settings using Rule Set Configuration Picker we locate and pick our ApplicationRuleSet that we created previously in this tutorial.
Then, for the ApplicationData Rule Set Input we Select Value of the Application data defined in the Create Data step.
In the Create Data step our Application data members are set to Constant values for the simplicity of this example.
Next, we connect the outcome from our Run Rule Set step to the End Step in the Flow . Also, we are going to output FlowRuleSetResult outcome from the Run Rule Set step on the End Step in our Flow .
This completes our Flow . We can click Debug Flow on the top panel of the Flow Designer to test the results of our Rule Set.
Our Flow executes in the Debugger … We select End Step on the Flow execution diagram and click Show Step Info action. In the Show Step Info pop-up window we should see the information about our two Rules evaluation from our Rule Set based on our Application data:
- First Rule evaluated ‘True’ because our Applicant was older than 21 .
- Second Rule evaluated ‘False’ because our Applicant State was not NC .