Create Data Pairs
  • 16 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

Create Data Pairs

  • Dark
    Light

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. "Nameis 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

Alternative Example: Lookup list Example
Navigate to Lookup list to view how Data pairs are used for Lookup lists.
  1. In a Designer Project, create a Flow via the CREATE FLOW button.
  2. Under the top Action bar, select the SETUP INPUT DATA button, click DEFINE, then define the Input Data.
  3. Create two String Inputs, one called Age, and one PersonName. 
  4. Save the Input Data, then close it via the button. 

  5. Attach a Create Data step from the Toolbox tab on the left, to the Done path of the Start step.
  6. With the step selected, click SHOW EDITOR in the Properties tab to add the variables. 
  7. Provide a Name and search for and select DataPair   [DecisionsFramework.ServiceLayer.Services.ContextData] from the Type selector.
  8. The example below makes a Data Pair List (check the "Is List" checkbox to make it a List).
  9. Under Input, click  Edit to map in values. Select Build Array to build out each Data Pair in the list. 
  10. Under each Item, use a Build Data mapping to expose the each part of the Data Pair. 
  11. For the Name fields, use Constants and input "Name" and "Age". 
  12. On the Output Value fields, Select Form Flow map in the Start step values to their respective fields. 
  13. CLOSE the Data Definitions window to save changes and return to the Flow Designer.
  14. Connect the Done path from the Create Data step to the End step. Save the Flow, then close (X) if desired. 

Debug

  1. From the Flow Designer, Run the Debugger via the Debug link in the top Action bar.
  2. Under New Sessions, provide the Inputs then select Run Capturing All.
  3. 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 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}





Was this article helpful?