Truth Tables in Rule Set
  • 30 Jun 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 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.

  1. Create a new Rule Set.
  2. 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.
  3. 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.
  4. When the Rule Designer appears, click [Select Data Element] and choose Item > Company.
  5. Next, click [Pick Verb] and select Is from under the Common > Evaluate category and click CLOSE.
  6. Next, add evaluation values (Decisions.com, That Other Company) under the Item.Company is column.
  7. 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.
  8. Click Save and close the Rule Designer window.
  9. 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.
  10. Next, add the Fetch Entities step.
  11. With the Fetch Entities step still selected, enter "account" in the Type Name dropdown list box and select Account [DecisionsFramework...].
  12. Add the For Each Element step. This can be found by searching foreach in the steps toolbox
  13. Under the DATA category, select Account as the Type.
  14. Next, under Collection on the INPUTS category, click EDIT. Then, select Entity Results and click DONE.
  15. Next, click the Next path on the For Each Element step. Then, select Designer Entities > Rules and add the Run Rule Set step.
  16. In the Flow Designer, click the Done path of the Run Rule Set. Add the True False Rule step from the Designer Entities > Rules category.
  17. 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.
  18. 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.
  19. Click Save to save changes to the Flow.

Debug

  1. Click Debug on the top action panel. Then, click START DEBUGGING.
    For further information on Rules, visit the Decisions Forum.

Was this article helpful?