- 30 Jun 2022
- 1 Minute to read
Returning Multiple Values in Truth Tables
- Updated on 30 Jun 2022
- 1 Minute to read
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.
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.
- 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.
- Click [Select Data Element] and pick Age from the list, then click Close.
- The Pick Verb window will open automatically, select Between from the Number Rules section and then click Close.
- Hover over the top Default Output Data cell and click the pencil icon when it appears.
- Replace DefaultOutputData with Can Rent for the Name field then click OK. Leave Boolean [Logical] as the Type.
- 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.
- Repeat the above steps to create a new output column with the name CostPerDay and Int32 as the Type, then click OK.
- Now that the outputs are configured, Define three separate rows for testing, as shown below
- Click the Debug button on the top Action Bar of the Rule Designer.
- 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.