Truth Tables in Rule Set
- 15 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
Truth Tables in Rule Set
- Updated on 15 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
Using Truth Tables in Rule Sets allows designers to avoid the creation of numerous Rules that have the same conditions but differ only in the value to evaluate data against.
Example
This example fetches accounts that have been created in Decisions. A Truth Table within the Rule Set will run 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. Below is a downloadable example to import into Decisions.
- Create a new Rule Set.
- Click Setup on the top action bar to open the Setup Rule Set dialog window. Under the RULE TYPES category, select Truth Tables and then click SAVE to close the dialog window.
- On the top action panel, click ADD TRUTH TABLE and select Truth Table. Enter "Company and Job Title Truth Table" in the Name field and click CREATE TRUTH TABLE.
- When the Rule Designer appears, click [Select Data Element] and choose Item > Company.
- Next, click [Pick Verb] and select Is from under the Common > Evaluate category and click CLOSE.
- Next, add evaluation values (Decisions.com, That Other Company) under the Item.Company is column.
- Click the plus sign next to the Item.Company is column to add another condition. Configure this second condition to evaluate Item.JobTitle In List.
Then, select both check boxes under Default Output Data. This example will use a static list of Job Titles (Designer, Administrator) as a constant. - Click Save and close the Rule Designer window.
- In a Designer Project, create a Flow by clicking CREATE FLOW on the global action bar and selecting Flow on the top of the dialog window.
- Next, add the Fetch Entities step.
- With the Fetch Entities step still selected, enter "account" in the Type Name dropdown list box and select Account [DecisionsFramework...].
- Add the For Each Element step. This can be found by searching foreach in the steps toolbox
- Under the DATA category, select Account as the Type.
- Next, under Collection on the INPUTS category, click EDIT. Then, select Entity Results and click DONE.
- Next, click the Next path on the For Each Element step. Then, select Designer Entities > Rules and add the Run Rule Set step.
- In the Flow Designer, click the Done path of the Run Rule Set. Add the True False Rule step from the Data > Rules category.
- Under the INPUTS category, select Unknown and choose Select From Flow.
Then, select FlowRuleSetResult.First.RuleResult and select DONE to close the window. By choosing FlowRuleSetResult.First.RuleResult, the Flow will stop on the first false. - Next, connect the False path on the True False Rule to the End step and the True path to the For Each Element step.
Then, connect the No Results path to the For Each Element step. Then, connect the Done path from the For each Element step to the End path. - Click Save to save changes to the Flow.
Debug
- Click Debug on the top action panel. Then, click START DEBUGGING.For further information on Rules, visit the Decisions Forum.
Was this article helpful?