Creating a Truth Table
  • 07 Sep 2021
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Creating a Truth Table

  • Dark
    Light

Overview

A Truth Table receives user data and evaluates it against configured conditions based on input data. Truth Tables are configured with a data element and verb selected in each header, then possible choices that the Rule logic can check for are listed in each row underneath. Outputs typically return a Boolean result (true or false) but can be configured to return a custom result as well. Whichever outcomes are applied to the Truth Table will appear as outcome paths in the Flow. 

Example

In this example, a truth table will be created to determine what recipes can be made based on the input of the ingredients and time available to cook.

  1. In a Designer Project, click CREATE FLOW. Select Default, select Flow and click CREATE. Name the Flow and click CREATE.
  2. Click the Done path on the Start step. Select Show Form and click ADD.
  3. On the Properties Panel, click Pick or Create Form. Name the Form and click CREATE.
  4. Configure the Form to have a Check Box List (IngredientsOnHand), Number Box (TimeAvailableToCook), and a Button (Submit). When done, click Save and close the Form.
  5. Click on the Submit path. Select Run Truth Table and click ADD.
  6. On the Properties panel, click Create under Target. Name the Truth Table and click CREATE.
  7. In the Rule Designer, click SETUP INPUT DATA.
  8. On the Data Definitions window, add Ingredients as a String [Text] Type as a list and MinutesAvailable as an Int32 [Number] Type. Click CLOSE.
  9. Click [Select Data Element] and choose Ingredients. Click CLOSE.
  10. On the [Pick Verb] window, and select List Contains Any. Click CLOSE.
  11. Click the plus sign next to the Ingredients column and configure the Rule logic to MinutesAvailable is in between.
  12. Hover over the Default Output Data column and click the pencil icon. Name the column "Recipe" with a String Type and click OK.
  13. In the Ingredients column, click the pencil icon to edit the field. Enter "Flour, Chicken, Parmesan" in the value field and click CLOSE. Under the MinutesAvailable column, click the pencil icon and enter "15" as the low value and "25" as the High Value. In the Recipe column, enter "Chicken Parmesan".
  14. Add another row by clicking on Click To Add Row.
  15. In the next row, enter "Flour, Chicken" for Ingredients, "10 and 20" for MinutesAvailable, and "Fried Chicken" for Recipe.
  16. Add another row with "Shrimp, Garlic, Parmesan", "20-30", and "Creamy Garlic Shrimp". Save and close the Rule Designer.
  17. With the Truth Table selected, click Edit Input Mappings.
  18. Map the Ingredients On Hand to Ingredients and map Time Available To Cook to Minutes Available. Click OK.
  19. Connect the Done path to the End step. Save the Flow.


Debug

  1. On the top action bar, click Debug. Click FULL.
  2. Select Flour and Chicken and then enter 16 for Time Available to Cook. Click Submit.
  3. After the debugger runs, select the Run Truth Table step, select Execution 1, and click View Input/Output Data.
    The Output results will display the outcomes that matched the inputs.



Was this article helpful?