Manipulating Lists Overview
  • 08 Sep 2021
  • 3 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Manipulating Lists Overview

  • Dark
    Light

Article summary

Overview 

By utilizing the power of the Flow Designer, as well as the Data Definitions window, users may create a singular List of any Data Structure. After establishing a List, users may then use a number of Flow steps to edit and manipulate the List as desired/needed. The following document discusses how to use three List manipulation steps (Add Item(s) to List, Remove Item From List, and Get Item By Index) to edit Lists in from the Flow Designer. 


Creating Lists 

To create a List from the Flow Designer out of any Data Type: 

  1. From the Decisions Studio, select CREATE FLOW from the Global Action Bar, then CREATE a new Flow
  2. From the Flow Designer select the Start step. Then, from the Properties tab, under Flow Data > Flow Input Data, select Show Editor
  3. From the Data Definitions window provide a Name. Then under Type, select desired Data Type (for this example select String [Text]). Then, check the Is List Boolean
  4. Under Input, select Edit. Then, Constant map the desired List of String Input, separating each value by line. Then click CLOSE. 

  5. CLOSE the Data Definitions window.


Example A: Add Item to List Step 

About Add Item to List Step 
The Add to List Step is a Flow step that is used to append a List by adding a new Item of the matching Data Type, to that List. 

To configure an Add Item to List Step:

  1. From the Flow Designer, from the Steps tab, navigate to Steps > Data > List, and add an Add Item to List Step to the Start step. 
  2. Select the Add Item to List Step to navigate to its Properties tab. 
  3. From the Data section of the Add Item to List Step's Properties, select the desired AddToListPosition. Then select the corresponding ListType
    About Data Options 
    The AddToListPosition Property allows users to dictate where the new value is placed in the List. Users have the option to either AddToBeginning or AddToEnd.ListType is used to select the compatible Data Type value of the List being added to. For this example, leave ListType set to String [Text].

  4. Under Properties > Inputs, Select From Flow map the previously created Input Data to Original List. Then Constant map a New Item

    Additional Information on Inputs 
    The Original List Input is the List that is being appended by the Add Item to List Step.
    New Item is the Item being added to the Original List. 

Add Items to List Step 

Similar to the Add Item to List Step, the Add Items to List step is used to append a List by adding an Item to a List. The Add Items to List Step differs from the Add Item to List Step in that it is used to map multiple objects to the List, rather than just one.

These objects may be mapped in a similar manner to how a List is initially defined on the Input Data of a Flow


Example B: Get Item By Index by Index 

About Get Item by Index 
The Get Item by Index step is used to obtain values from an existing List by providing an Item Index for context of its location within the List.

To configure a Get Item by Index step:

  1. From the Flow Designer, navigate to Data > List and attach a Get Item by Index step to the Add Item to List Step.
  2. From the Properties tab of the Get Item by Index step, under Inputs, Select From Flow map the Output from the Add Item to List Step (New List) to the List Input
  3. Under Item Index, Constant map  the desired Int32 numerical value.
    Additional Information
    The List Input is used to map the desired List the Item will be pulled from. The Item Index Input represents the Item's placement in the list starting from 0 (this represents the first value) up to the number of Items in the List.

    The ListType Input represents the Data Type of the involved List. If a List is dynamically mapped to the List Input, this value should adjust to its expected Data Type. 



Example C: Remove Item From List 

About Remove Item From List 
The Remove Item From List step is used to remove a designated Item (Item to Remove) from a defined List. Both Items and List may be dynamically mapped, or Constant mapped onto each Property respectively. 

To map a Remove From List step: 

  1. From the Flow Designer, navigate to Steps > Data > List, and attach a Remove Item from List step to the Get Item by Index step as well as the End step. 
  2. From the Properties tab of the Remove Item from List step, Select From Flow map New List to the List Input.
  3. Map List Item to Properties > Inputs > Item to Remove
  4. Save the Flow, then if desired Close the Flow Designer. 

Debug 

  1. From the Flow Designer, select the Debug link from the top Action bar. 
  2. Click Run Capturing All
  3. After the Flow runs select Add Item to List Step 1 > Execution 1 > View Input/Output Data; verify that the step has added the New Item to the Original List
  4. Exit the View Input/Output Data window, then select Get Item by Index 1 > Execution 1 > View Input/Output Data
  5. Verify that the step OUTPUTS the proper List Item via the provided Item Index


  6. Exit this Input/Output Data window, then navigate to Remove Item from List 1 > Execution 1 > View Input/Output Data

  7. Verify that the step has removed the designated Item to Remove and has Output the New List with the properly updated values. 



Was this article helpful?