Using Multiple Data Return Truth Tables
  • 11 Oct 2021
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Using Multiple Data Return Truth Tables

  • Dark
    Light

Article summary

Overview

A Truth Table is a type of rule that can take in multiple inputs and return multiple outcomes. Truth Tables can be configured to return more than one outcome, which is helpful when there is a single set of data that a developer may need to be analyzed in multiple ways. In version 6, the option to have multiple pieces of data returned in a Truth Table is available by default. 


Example

This example will explore creating a basic Truth Table that takes in the age of an applicant to return multiple true/false evaluations based on the criteria configured. The Truth Table will show whether the applicant should rent a car, whether a young driver fee is applied, and what the estimated cost per day is.

  1. Begin in a Designer Folder, select the CREATE RULE button from the Action Bar. Select Truth Table and click CREATE. Name the Rule (Car Rental Restrictions) and click CREATE.
  2. In the Rule Designer, click SETUP INPUT DATA.
  3. When the Data Definitions window appears, enter "Age" in the Name field and Int32[Number] as the Type. Click CLOSE to close the Data Definitions window.
  4. Click [Select Data Element] and select Age from the list. Then, click CLOSE.
  5. On the [Pick Verb] window, select Between from the Number Rules category and then click CLOSE.
  6. Hover over the Default Output Data cell and click the pencil icon when it appears.
  7. Enter "CanRent" in the Name field and leave Boolean [Logical] as the Type. Then, click OK.
  8. Click the plus icon to the right of the Can Rent cell and create two more fields: IsYoungDriver with Boolean [Logical] as the Type and CostPerDay as an Int32 [Number]Then, click OK.
  9. Hover over the 0 and 0 input value and click the pencil icon when it appears. Define the Low Value for this age range as "0" and the High Value as "16"Click CLOSE
  10. Click Click To Add Row to add one row with a Low Value of 17 and a High Value of 24. Then, add another row with a Low Value of 25 and a High Value of 1000.
    The Equals High/Low box when defining the age range allows the Designer to select an option where the rule is still evaluated if the Age is equal to the High or Low value, or both.


  11. Click the checkbox for Can Rent and Is Young Driver on the second row. Hover over the zero under Cost Per Day for this row and click the pencil icon, then define Specified Cost Per Day as "45".
  12. Click the checkbox for Can Rent on the last row. Hover over the zero under Cost Per Day for this row and click the pencil icon and define Specified Cost Per Day as 35.


Debug

  1. Click the Debug button on the top action bar of the Rule Designer.
  2. Under the Default Inputs section, enter "23" as the Age and click Run Capturing All.
    The Truth Table will evaluate that based on the applicant's age of 23. The results show that the individual is able to rent a car (True evaluation on Can Rent), considered a Young Driver (True evaluation on Is Young Driver), and the estimated cost per day is 45 (45 value configured on Cost Per Day).




Was this article helpful?