Sort items in collection
The Sort items in collection action A tool for building the processes, logic, and direction within workflows. sorts the items in the specified collection A variable containing multiple items, such as email addresses. Collection variables are useful for storing and operating on query results. For example, you can set up collection variables for names, email addresses, and index values to store results from querying a list. You can then loop through items in a particular collection variable (names, emails, or index values). in either ascending or descending direction.
For example, alphabetically sort a list of names.
Before you begin:
-
Understand Variables
-
Understand the Start a loop and Loop for each actions
Jump to:
Add and configure the Sort items in collection action
In the Designer page:
-
Click the Collection operations action group in the action toolbox.
or
Find actions by browsing action groups, or by typing an action name or function in the Search field at the top of the action toolbox.
- Drag the Sort items in collection action to the point in the workflow when you want to sort items in a collection variable.
- Click the Sort items in collection action.
-
Complete the fields. For more information on the fields, see Sort items in collection fields.
Field
Example configuration
Example returned contents
Target collection collProduce lemon; apple; carrot; romaine
Sort direction
ascending
Output
collProduceSorted
apple; carrot; lemon; romaine
Field |
Description |
Variable types |
---|---|---|
Target collection | Collection variable that you want to sort. Accepts an inserted variable. |
Collection |
Sort direction |
Direction in which to sort items. Accepts a selection from the drop-down list. Options are ascending and descending. |
(n/a) |
Output |
Collection variable to store sorted items. Accepts an inserted variable. |
Collection |