- 07 Sep 2021
- 2 Minutes to read
Creating a Truth Table
- Updated on 07 Sep 2021
- 2 Minutes to read
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.
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.
- In a Designer Project, click CREATE FLOW. Select Default, select Flow and click CREATE. Name the Flow and click CREATE.
- Click the Done path on the Start step. Select Show Form and click ADD.
- On the Properties Panel, click Pick or Create Form. Name the Form and click CREATE.
- 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.
- Click on the Submit path. Select Run Truth Table and click ADD.
- On the Properties panel, click Create under Target. Name the Truth Table and click CREATE.
- In the Rule Designer, click SETUP INPUT DATA.
- On the Data Definitions window, add Ingredients as a String [Text] Type as a list and MinutesAvailable as an Int32 [Number] Type. Click CLOSE.
- Click [Select Data Element] and choose Ingredients. Click CLOSE.
- On the [Pick Verb] window, and select List Contains Any. Click CLOSE.
- Click the plus sign next to the Ingredients column and configure the Rule logic to MinutesAvailable is in between.
- Hover over the Default Output Data column and click the pencil icon. Name the column "Recipe" with a String Type and click OK.
- 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".
- Add another row by clicking on Click To Add Row.
- In the next row, enter "Flour, Chicken" for Ingredients, "10 and 20" for MinutesAvailable, and "Fried Chicken" for Recipe.
- Add another row with "Shrimp, Garlic, Parmesan", "20-30", and "Creamy Garlic Shrimp". Save and close the Rule Designer.
- With the Truth Table selected, click Edit Input Mappings.
- Map the Ingredients On Hand to Ingredients and map Time Available To Cook to Minutes Available. Click OK.
- Connect the Done path to the End step. Save the Flow.
- On the top action bar, click Debug. Click FULL.
- Select Flour and Chicken and then enter 16 for Time Available to Cook. Click Submit.
- 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.