Truth Tables in Rule Set
- Updated on 05 Mar 2019
- 2 minutes to read
This example demonstrates how to use Truth Tables in Rule Sets in Decisions 4.0 . Using Truth Tables inRule Sets allows designers to avoid creation of numerous Rules that have same Conditions but differ only in Value to evaluate data against.
- Fetch Entities: All Steps [Catalog] > Integration > Entity Framework
- ForEach Step: All Steps [Catalog] > Flow Management
- Run Rule Set: All Steps [Catalog] > Rules
- True False: All Steps [Catalog] > Data > Rules
The below image is of the completed example. This example fetches accounts that have been created in Decisions, for each account a truth table within a rule set runs to confirm each account has a designated Company and Job Title. The output from the rule set is passed to the True False rule to stop the flow on the first false.
On the Fetch Entities step under Type Name select Accounts.
From the Fetch Entities Results outcome path add the ForEach Step. Configure the ForEach Step to take in Account as the Data Type. Under Inputs > Collection choose Entity Results.
Run Rule Set
From the ForEach Step Next outcome path add the Run Rule Step. To configure the Run Rule Set step select Create Rule Set within the Properties panel.
Run Rule Set
Create Rule Set dialog will appear, name the rule set and add data to be available. Select OK to open the Rule Designer.
Setup Rule Set dialog will appear, under Rule Types select Truth Tables, then Save to close the dialog.
In the bottom action panel, select Add Rule > Truth Table. Name the Truth Table then select Create Truth Table.
Within the Rule Editor, open [ Select Data Element], choose Item > Company. Then open [Pick Verb], choose Is from the drop down menu.
Within the Item.Company Is column add the evaluations. Select add row to add more rows to the rule.
To add another column, select add condition. In the same manner as the first condition, configure the second condition to evaluate Item.JobTitle In List. In this example a static list of a few Job Titles is added as a constant.
Select both boxes within the Result column. Save and Close.
True False Rule
Back in the Flow Designer, from the outcome path of Run Rule Set, add True False Rule. Under Inputs > value, chose FlowRuleSetResult.First.RuleResult. This is chosen to stop the flow on the first false.
Connect the Pathways and Debug the Flow
After the Steps are configured and the pathways are connected as displayed in (Figure 1). Complete the flow by selecting Debug and verify that the flow works as intended.