- 26 Jun 2024
- 2 Minutes to read
- Print
- DarkLight
Create Data Pairs
- Updated on 26 Jun 2024
- 2 Minutes to read
- Print
- DarkLight
Overview
Data Pairs, also known as "attribute-value pairs", "Key-Value" pairs, or"Name-value" pairs, are a set of two linked data items. In the "Name-Value" pair, the "Value" is a generic object. This object could be a String, Number, Date, Composite Object, etc. "Name" is the identifier. It is either the data that is identified or a pointer to the location of that data. Data Pairs are used when users are either working with generic objects or do not know what the schema is going to be used during runtime. Data Pairs are useful for any time users need a list that has associated values but no Database related connection such as, extension_id/entity_folder_id (string + value). Data pairs are not DB stored. This tutorial explains how to create Data Pairs in Decisions.
Example
- In a Designer Project, create a Flow via the CREATE FLOW button.
- Under the top Action bar, select the SETUP INPUT DATA button, click DEFINE, then define the Input Data.
- Create two String Inputs, one called Age, and one PersonName.
- Save the Input Data, then close it via the X button.
- Attach a Create Data step from the Toolbox tab on the left, to the Done path of the Start step.
- With the step selected, click SHOW EDITOR in the Properties tab to add the variables.
- Provide a Name and search for and select DataPair [DecisionsFramework.ServiceLayer.Services.ContextData] from the Type selector.
- The example below makes a Data Pair List (check the "Is List" checkbox to make it a List).
- Under Input, click Edit to map in values. Select Build Array to build out each Data Pair in the list.
- Under each Item, use a Build Data mapping to expose the each part of the Data Pair.
- For the Name fields, use Constants and input "Name" and "Age".
- On the Output Value fields, Select Form Flow map in the Start step values to their respective fields.
- CLOSE the Data Definitions window to save changes and return to the Flow Designer.
- Connect the Done path from the Create Data step to the End step. Save the Flow, then close (X) if desired.
Debug
- From the Flow Designer, Run the Debugger via the Debug link in the top Action bar.
- Under New Sessions, provide the Inputs then select Run Capturing All.
- On the Create Data step, right-click and select "Output" to read the output Data Pair.
Data Pair Steps
As an alternative to the Create Data step, In a Flow Designer, users can find various steps pertaining to creating Data Pairs under the Toolbox in the Data>Data Pair Folder.
Below is a table that provides information on each of the default Create steps for Data Pairs. These steps will create single Data Pairs and not a list, like the first method discussed above.
Step Name | Description | Inputs |
Create Logical Data Pair | This step creates a data pair that uses a boolean value type. |
|
Create Number Data Pair | This step creates a data pair that uses a number as the value type. |
|
Create Object Data Pair | This step creates a data pair that uses the Object as the value type. An object data type can box up any datatype (user-defined, String, decimal, Boolean, etc) |
|
Create String Data Pair | This step creates a data pair that uses a string as the value type. |
|