About Truth Tables
- Updated On 25 Nov 2020
- 1 Minute To Read
Truth Tables are rules that compare the possible combinations of multiple inputs, allowing the user to arrive at different outcomes depending on the specific combination. A truth table can output a piece or pieces of data, or take action by calling a flow. This Rule is represented as a table where conditions can be added at the top (Predicate and Verb), and nouns are defined as rows of the Truth Table along with an expected Results (Outcome Data). Truth Tables can be configured to return more than one outcome. This is helpful when there is a single set of data that a developer may want to be analyzed in more than one way.
Explanation of the Truth Table Rule Types:
- Data Return Rule (Single): Returns a single variable into the flow.
- Action Rule: Passes in value and executes a flow.
- Data Return Rule (Multiple, Composite Type): Creates a new datatype based on the fields that are specified in the return. This allows the developer to dynamically create datatypes for the output of the truth table based on what fields are defined.
- Data Return Rule (Multiple): Returns multiple variables into the flow.
Below is an example of a Truth Table.
Truth Tables can be used for a wide assortment of use cases. Truth Tables are best used for cases that involve Rules that utilize multiple nested "if" statements. One such implementation may involve the validation of data such as evaluating when to approve a car rental for a company by looking at when the car is being rented, the cost to the company, and the position of the person requesting the rental. So if the request is made by Person X, and if it is rented for X amount of days, and costs the company X amount of dollars, then the request will be approved.
Due to their ability to be created using either internally or externally sourced data, they can be helpful for tracking data pertaining to a System and/or that System's Accounts such as Account permissions. This can be accomplished by evaluating a specific permission as an Input and comparing it against Accounts within a system that have those permissions as the Output. This may be Input statically through the Rule Designer or dynamically by creating a Truth Table externally via a Report.