Returning Multiple Values in Truth Tables
  • 30 Jun 2022
  • 1 Minute to read
  • Dark
    Light

Returning Multiple Values in Truth Tables

  • Dark
    Light

Article Summary

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. 

The result of the Truth Table will be outputted as a list of objects.


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 is able to rent a car, whether a Young Driver fee is applied, and the estimated cost per day is.

  1. Create a Truth Table. When the Data Definitions window appears, define an input as Age and set the Type to be Int32, then close the Data Definitions window. 
  2. Click [Select Data Element] and pick Age from the list, then click Close. 
  3. The Pick Verb window will open automatically, select Between from the Number Rules section and then click Close.
  4. Hover over the top Default Output Data cell and click the pencil icon when it appears.
  5. Replace DefaultOutputData with Can Rent for the Name field then click OK. Leave Boolean [Logical] as the Type
  6. Click the plus icon to the right of the Can Rent cell. Define this new Output Data with the name IsYoungDriver and Boolean [Logical] as the Type, then click OK. 
  7. Repeat the above steps to create a new output column with the name CostPerDay and Int32 as the Type, then click OK.
  8. Now that the outputs are configured, Define three separate rows for testing, as shown below

Debug

  1. Click the Debug button on the top Action Bar of the Rule Designer.
  2. Under the Default Inputs section, define the Age as 23, then click Run Capturing All.

    The Truth Table will evaluate the input data. The output will evaluate whether they are able to rent a car, if they are a young driver, and their estimated cost per day is 45.



For further information on Rules, visit the Decisions Forum.

Was this article helpful?