Truth Tables in Rule Set
  • 24 Oct 2022
  • 2 Minutes to read
  • Dark
    Light

Truth Tables in Rule Set

  • Dark
    Light

Article Summary

Overview

Using Truth Tables in Rule Sets allows designers to avoid creating 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.


  1. In the Designer Project, create a Flow by clicking CREATE FLOW on the global action bar and selecting Flow at the top of the dialog window. Then, enter "Truth Tables in Rule Set" in the Name field and click CREATE to open the Flow Designer.
  2. Next, click the Done path and add the Fetch Entities step.
  3. With the Fetch Entities step still selected, enter "account" in the Type Name dropdown list box and select Account [DecisionsFramework...].
  4. On the Fetch Entities step, click the Results path and add the For Each Element step.
  5. Under the DATA category, select Account as the Type.
  6. Next, under Collection on the INPUTS category, click EDIT. Then, select Entity Results and click DONE.
  7. Next, click the Next path on the For Each Element step. Then, select Flows, Rules, Forms and Reports > Rules and add the Run Rule Set step.
  8. From the Properties panel, click Create Rule Set. When the Create Rule Set dialog window appears, put "Evaluate Company and Job Title" in the Name textbox and click CREATE RULE SET.
  9. Click Open Rule Set to open the Rule Designer in a new browser window tab.
  10. 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.
  11. 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.
  12. When the Rule Designer appears, click [Select Data Element] and choose Item > Company.
  13. Next, click [Pick Verb] and select Is from under the Common > Evaluate category and click CLOSE.
  14. Next, add evaluation values (Decisions.com, That Other Company) under the Item.Company is column.
    Select Click To Add Row to add more rows to the rule.
  15. 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, Document Writer) as a constant.

  16. Click Save and close the Rule Designer window.
  17. In the Flow Designer, click the Done path of the Run Rule Set. Add the True False Rule step from the Flows, Rule, Forms and Reports > Rules category.
  18. Under the INPUTS category, select Unknown and choose Select From Flow. Then, select FlowRuleSetResult.First.RuleResultand select DONE to close the window.
    By choosing FlowRuleSetResult.First.RuleResult, the Flow will stop on the first false.


  19. 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.
  20. Click Save to save changes to the Flow.

Debug

  1. Click Debug on the top action panel. Then, click START DEBUGGING.

Was this article helpful?