Using Collection Sort Step
  • 16 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

Using Collection Sort Step

  • Dark
    Light

Article Summary

Overview

The Collection Sort step takes in a List of Items and compares them in the Filter Flow. The Filter Flow runs these items through the sorting logic that was configured, and based on the logic, sorts and configures the order of the list. This step can implement the desirable sorting logic for the collection of any existing type.


Example

The following tutorial demonstrates how to configure and use the Collection Sort Step. This step can be found under the DATA LIST category in the Flow Designer. This step can implement desired sorting logic for the Collection of any existing Type. To download an example please navigate to Example Lab: Using a Collection Sort Step.
  1. From a Designer Project, select CREATE FLOW from the top Action bar.
    1. Select Flow, provide a Name, and click CREATE.
  2. Attach a Get All step from the INTEGRATION > INTERNAL SERVICES > ACCOUNTSERVICE category of the Toolbox tab, to the Start and End step. 
  3. Add and attach a Collection Sort Step from DATA > LIST, to the Get All step. 
  4. Navigate to the Collection Sort Step's Properties tab and map GetAll_Output.All EmailAddress to INPUTS > Input Collection
  5. Select the EDIT *FLOW NAME* button. 
    This Filter Flow is where the sorted logic is configured. The Filter Flow has a Start step with First Entity and Second Entity inputs (of the Collection Type). Three End steps are provided, Entity First Sorts First, Entity Second Sorts First, Entity First and Second Sorted The Same. 

    The works by taking Item0 and Item1 from the Array, then running those two Items through the sorting logic (set of Rules to compare these two Items). Based on the sorting results, the order of these two items is configured. Then, this Flow runs again but the second time setting Item0 in the array based on the first run and taking Item1 and Item2 from the array.
  6. From the DATA > TEXT category of the Toolbox tab, attach a Text AAlphabetically Comes Before TextB step to the Start step.
    These steps will be used to determine which String is placed first in Alphabetical order.

    Note that Strings will be sorted according to ICU (International Components for Unicode)order, placing any Strings in the following order:

    1. Strings leading with numbers, placed in numerical order.
    2. Strings leading with special characters by ICU order. 
    3. Strings leading with letters in alphabetical order.

    For more information regarding ICU, see: International Components for Unicode.

  7. From the Text AAlphabetically step's Properties tab, map FirstEntity to TextA and SecondEntity to TextB
  8. Connect the True path to Entity First Sorts First.
  9. Attach an additional TextA Alphabetically Comes Before TextB step to the False path. 
  10. In the second TextA Alphabetically step, map FirstEntity to TextB, and SecondEntity to TextA. 
  11. Connect the True path to Entity Second Sorts First, and the False path to Entity First and Second Sorted the Same.
  12. Save and close the CollectionSortStep Flow
  13. From the Main Flow, connect the Done path to the End step, Save the Flow, then close with if desired.




Debug

  1. From the Flow Designer, select Debug from the top Action bar. 
  2. Click START DEBUGGING.
  3. Select View Input/Output Data on the Collection Sort Step.
    Note that the Output is the Input list of Email Addresses now placed in alphabetical/ICU order. 




Was this article helpful?