Creating an External Truth Table
  • 21 Jul 2022
  • 5 Minutes to read
  • Dark
    Light

Creating an External Truth Table

  • Dark
    Light

Overview

An External Truth Table is a type of Truth Table whose rows are populated externally. This source is written in the Reporting Engine and can use any data that Decisions can report on, including Excel files and integrations.

The following example demonstrates how to create a Truth Table that sources data externally via a Report generated in the Designer. 


Properties

The following sections and charts detail the function of each property found in the External Truth Table's Properties tab. 

Service Settings

The SERVICE SETTINGS category configures properties regarding the use of API Services to call the External Truth Table

PropertyFunctionData Type
Integration Type Dictates whether the Truth Table is or isn't called using a REST Service that supports HTTP methods. ---

API Service Uses REST to call on the Truth Table.---


Data Format Determines the format of the called Truth Table; options include JSON, Raw, RawJson, RawXml, and XML. ---


Reference TypeChooses the method by which the Truth Table is referenced; options include Id, Id or Path, Path, and Url.---


Override Service URLAllows customization of the Service URL. The Service URL allows the user to make API calls using the Base Portal URL, followed by "restapi" and the rest of the user-configured Url. Boolean 


Configure HTTP MethodsSelects the desired HTTP methods; GET, POST, and/or PUT. Boolean

NoneDoes not use REST to call the External Truth Table.---

Data Source

DATA SOUCE is used to dictate how to source data for the External Truth Table

PropertyFunctionData Type
EDIT EXTERNAL TRUTH TABLEOpens the Report Designer to specify data for the Truth Table.---
Data Source Cache TimeSets the cache time for the specified data source. Int32

External Truth Table

This section configures how the the External Truth Table responds in the event of specific Rule outcomes. 

PropertyFunctionData Type
Ignore Rules With Null ValuesIgnores null value returns. Boolean
Ignore Rules With Empty ValuesWill ignore empty values. Boolean
Ignore Rules With Specified ValuesWill ignore specified value entries. String
Has No Match OutcomeSpecifies outcome when the External Truth Table returns no matches.Boolean

Input 

Used to determine how data is provided for the Input column of the Truth Table

PropertyFunctionData Type
Specify Default InputsAllows the user to provide default data for the Truth Table from within the Truth Table Designer. Boolean
PICK OR CREATE DEFAULT SAMPLE SETAllows the user to PICK or CREATE a Report for use as sample data.---

Output 

This section pertains to the how data is handled after the Truth Table is run. 

PropertyFunctionData Type
Allow ActionsEnables the UNITTESTS category which is used to enable Actions on Unit Tests that are run using the Truth TableBoolean

Settings 

Determines whether the Truth Table is active/enabled and for what period of time. 

PropertyFunctionData Type
EnabledEnables the Truth Table by default.Boolean
Use Enabled RulesEnables the Truth Table based upon a user-defined Rule. Boolean
Begin DateEstablishes the beginning date for when the Truth Table is enabled. DateTime
End DateSets when the Truth Table will be disabled. DateTime

Example

This example demonstrates how to create an External Truth Table. The following file contains an example project to serve as a guideline. Please visit Importing and Exporting Projects for more information on how to import and export projects.

  1. In a Designer Project, click CREATE RULE from the Global Action Bar and select CREATE. Click Truth Table and select External Data Truth Table. Name the Rule and click CREATE.
  2. In the Rule Designer, click SETUP INPUT DATA.
  3. In the Input Data window, enter "EmailAddress" in the NAME field. Click Save and close the Input Data window.
  4. Click [Select Data Element] and select Email Address. Click CLOSE. 
  5. In the [Pick Verb], select Is and click CLOSE. 
  6. In the Default Output Data column, click the pencil icon when hovering over the Output Column. 
  7. The Output Column will be used for displaying the corresponding Last Name and First Name associated with the account found in the Input Column. Name the data (Last Name Is) and select String [Text] as the Type. Click OK. Click the plus sign icon and repeat this with First Name Is. 
  8. On the Properties panel, click EDIT TRUTH TABLE under the DATA SOURCE category.
  9. Under Data Sources, click Add and enter "CSV" in the search bar. Select CSV/Excel Data Source.
  10. On the Properties panel, select CHOOSE FILE and select a CSV or excel file to use.
  11. Select the First Name data field. On the Properties panel, navigate to Title under Settings. Select the dropdown and select First Name Is. Repeat this for the Last Name and Email data field.
    For the data fields to correlate to a title, the data field needs to be the same specified data type. If not, the title will not appear for the data field to be referenced to it.
  12. Click Save and Close the Report to return to the Rule Designer.
  13. Completing the previous configurations will populate the Truth Table with the External Data Report. Click Save to save changes to the Rule.


    If returning multiple outcome values, the option Create Composition Type is displayed. When multiple rows are returned from the truth table, all values are merged into a single list.


Truth Table Filtering 

  1. For additional control over filtering rows in a Truth Table or for the option to filter the Table based on the Output Column rather than the Input, Truth Tables contain a filtering feature. This feature can be helpful for situations that involve larger Truth Tables and offer a more controlled approach to filtering through Data. 
  2. To access this filter, from the Rule Designer, select the abacus button located above the Truth Table. 
  3. Input the desired filter in the Search box; this can be just a few characters or an entire Input/Output value. By default the filter is set to search for the Search value in All Columns; if desired, users may select either Column by itself by choosing an option from the dropdown selection. 
  4. Additionally, if desired, the filter offers the ability to sort the Columns in either ascending or descending order by selecting one of the Columns from the Sort By dropdown and then choosing either ASC or DSC.
    Note that sorting is determined by ICU order; this prioritizes Strings leading with special characters first, then those leading with numbers, and finally those leading with letters.
  5. Once the desired parameters have been selected, click APPLY to save changes and filter out the Table.

Debug 

  1. On the top action panel, click Debug
  2. Under Email Address, enter "LeviJones@test.com" and click START DEBUGGING.
    Running the Debugger will evaluate which row contains the selected Input and display those rows alongside their associated First and Last Name value pulled from the Data Source and evaluate this combination as True. All other values will be displayed as well, with a False evaluation instead.

For further information on Rules, visit the Decisions Forum.

Was this article helpful?