- 31 Jul 2024
- 5 Minutes to read
- Print
- DarkLight
Creating an External Truth Table
- Updated on 31 Jul 2024
- 5 Minutes to read
- Print
- DarkLight
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.
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.
Property | Function | Data 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 Type | Chooses the method by which the Truth Table is referenced; options include Id, Id or Path, Path, and Url. | --- | ||
Override Service URL | Allows 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 Methods | Selects the desired HTTP methods; GET, POST, and/or PUT. | Boolean | ||
None | Does not use REST to call the External Truth Table. | --- |
Data Source
DATA SOURCE is used to dictate how to source data for the External Truth Table.
Property | Function | Data Type |
---|---|---|
EDIT EXTERNAL TRUTH TABLE | Opens the Report Designer to specify data for the Truth Table. | --- |
Data Source Cache Time | Sets the cache time for the specified data source. | Int32 |
External Truth Table
This section configures how the External Truth Table responds in the event of specific Rule outcomes.
Property | Function | Data Type |
---|---|---|
Ignore Rules With Null Values | Ignores null value returns. | Boolean |
Ignore Rules With Empty Values | Will ignore empty values. | Boolean |
Ignore Rules With Specified Values | Will ignore specified value entries. | String |
Has No Match Outcome | Specifies 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.
Property | Function | Data Type |
---|---|---|
Specify Default Inputs | Allows the user to provide default data for the Truth Table from within the Truth Table Designer. | Boolean |
PICK OR CREATE DEFAULT SAMPLE SET | Allows the user to PICK or CREATE a Report for use as sample data. | --- |
Output
This section pertains to how data is handled after the Truth Table is run.
Property | Function | Data Type |
---|---|---|
Allow Actions | Enables the UNITTESTS category, which is used to enable Actions on Unit Tests that are run using the Truth Table | Boolean |
Settings
Determines whether the Truth Table is active/enabled and for what period of time.
Property | Function | Data Type |
---|---|---|
Enabled | Enables the Truth Table by default. | Boolean |
Use Enabled Rules | Enables the Truth Table based upon a user-defined Rule. | Boolean |
Begin Date | Establishes the beginning date for when the Truth Table is enabled. | DateTime |
End Date | Sets 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.
- 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.
- In the Rule Designer, click SETUP INPUT DATA.
- In the Input Data window, enter "EmailAddress" in the NAME field. Click Save and close the Input Data window.
- Click [Select Data Element] and select Email Address. Click CLOSE.
- In the [Pick Verb], select Is and click CLOSE.
- In the Default Output Data column, click the pencil icon when hovering over the Output Column.
- 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.
- On the Properties panel, click EDIT TRUTH TABLE under the DATA SOURCE category.
- Under Data Sources, click Add and enter "CSV" in the search bar. Select CSV/Excel Data Source.
- On the Properties panel, select CHOOSE FILE and select a CSV or Excel file to use.
- Select the First Name data field. On the Properties panel, navigate to Title under Settings. Select the drop-down 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.
- Click Save and Close the Report to return to the Rule Designer.
- 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
- 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.
- To access this filter from the Rule Designer, select the abacus button located above the Truth Table.
- 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 drop-down selection.
- 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 drop-down 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.
- Once the desired parameters have been selected, click APPLY to save changes and filter out the Table.
Debug
- On the top action panel, click Debug.
- 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.