Create Data Pairs
  • 02 Sep 2020
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Create Data Pairs

  • Dark
    Light

Article summary

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:

  1. Using the Create Data Step.
  2. 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 NameDescriptionInputs
Create Logical Data PairThis step creates a data pair that uses a boolean value type.
  • Name
  • Value {boolean}
  • Example output: {Is New Patient? : True}
Create Number Data PairThis step creates a data pair that uses a number as the value type.
  • Name
  • Value {decimal}
  • Example output: {Age : 26}

Create Object Data PairThis 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)
  • Name
  • Value {object}
  • Example output: in this example, the object is a user-defined datatype, "patient information", which contains multiple fields. (name, diagnosis, treatment, etc.)
    • {Patient: Name~Jane Doe, Diagnosis~ Headache, Treatment~ Need rest,} 

Create String Data PairThis step creates a data pair that uses a string as the value type.
  • Name
  • Value {string}
  • Example output: {Gender : Female}



Lookup list Example
Navigate to Lookup list to view how Data pairs are used for Lookup lists.



Was this article helpful?