- 02 Sep 2020
- 2 Minutes to read
- Print
- DarkLight
Create Data Pairs
- Updated on 02 Sep 2020
- 2 Minutes to read
- Print
- DarkLight
Overview
Data Pairs are known as "attribute-value pairs", "Key-Value" pairs, or"Name-value" pairs. They are a set of two linked data items. In the "Name-Value" pair, the "Value" is a generic object. It 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 don't know what the schema is going to be during runtime. Data pairs are useful for any time users need a list that has associated values but no Database related connection like 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 the example, users will create Data pairs in a Flow. In a Designer Folder, create a Flow: Designer Folder > Action bar > Create Flow>Flow.Default >'create'. on the start step add in two variables; "Person Name", "age" (both of the type String).
Creating Data Pairs
Data Pairs can be created in two ways:
- Using the Create Data Step.
- default step under Data>advance in a Flow designer Step section.
Create Data Step Method
In the Flow Designer, from the Step Tab, search for the "Create Data" step and drag it to the workspace. Click 'Show Editor' in the properties tab to add the variables. the Data Definition window will open. Provide a Name and for the Type use: "DataPair [DecisionsFramework.ServiceLayer.Services.ContextData]". The example below makes a Data Pair list (check the "Is List" checkbox to make it a list).
Click 'edit' on the Data Definition window to map in values. For the Name fields, use Constants and input "Name" and "Age". For the Output Value, "Select Form Flow" and map in the Start step values to the appropriate fields.
Test
Run the debugger and provide the inputs. on the Create data step, right-click and select "output". Here the data pair is available.
Data Pair Steps
In a Flow Designer, under the Step tab navigate to Data>Advanced>Data Pair. Here users can find various data pair steps that will create data pairs.
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. |
|