Sort the data stored in a list
In Power Automate Desktop, a variable that can hold multiple values is called a “list”.
This article explains how to sort the data stored in a list.
Sort a list
Section titled “Sort a list”Implement by copying and pasting
Section titled “Implement by copying and pasting”Copy the following code and paste it into the Power Automate Desktop flow designer to add the actions.
Variables.CreateNewList List=> ListVariables.AddItemToList Item: 3 List: List NewList=> ListVariables.AddItemToList Item: 1 List: List NewList=> ListVariables.AddItemToList Item: 2 List: List NewList=> ListVariables.SortList.SortList List: List SortedList=> ListImplement in Power Automate Desktop
Section titled “Implement in Power Automate Desktop”- In “Search actions”, type “Sort list”.
- Select the list you want to sort, and the data stored in it is sorted in ascending order.
Possible errors
Section titled “Possible errors”This action doesn’t throw any errors, so you don’t need to handle any.
Reverse a list
Section titled “Reverse a list”Implement by copying and pasting
Section titled “Implement by copying and pasting”Copy the following code and paste it into the Power Automate Desktop flow designer to add the actions.
Variables.CreateNewList List=> ListVariables.AddItemToList Item: 3 List: List NewList=> ListVariables.AddItemToList Item: 1 List: List NewList=> ListVariables.AddItemToList Item: 2 List: List NewList=> ListVariables.ReverseList List: List ReversedList=> ListImplement in Power Automate Desktop
Section titled “Implement in Power Automate Desktop”- In “Search actions”, type “Reverse list”.
- Select the list whose order you want to reverse, and the order of the data stored in it is reversed.
Possible errors
Section titled “Possible errors”This action doesn’t throw any errors, so you don’t need to handle any.