List(Power Automate Desktop)
This section introduces List(one-dimensional arrays), which deal with collections of variables.
- 1. Tool for Generate
- 2. Create
- 3. Operations on already existing List
- 3.1. Add
- 3.2. Get the count of items
- 3.3. Get item
- 3.4. Delete
- 3.5. Shuffle list. Randomly reorder items in the list.
- 3.6. Sort list. Sort items in the list in ascending order.
- 3.7. Reverse list.Sort list items in descending order
- 3.8. Remove duplicate items from list.
- 3.9. Converts elements to text by combining them
- 4. Match the two Lists
- 5. Clear list
- 6. For those who want to learn Power Automate Desktop effectively
- 7. Links
- 7.1. Power Automate Desktop Introduction.
- 7.2. Examples of Use
- 7.2.1. Obtain the number, total, average, maximum, and minimum of the numbers in the list.
- 7.2.2. How to get the deviation.
- 7.2.3. How to get the least common multiple and greatest common divisor.
- 7.2.4. How to rank a list of numbers.
- 7.2.5. How to get the median.
- 7.2.6. How to get the standard deviation.
- 7.2.7. How to get the mode.
- 7.2.8. Automated basic text file operations
Tool for Generate
Generate a list/data table with the structure as entered in Excel.
Create
First, the list must be created as a variable.
The procedure differs depending on whether the item (the contents of the list) is a list that does not exist or a list that does exist.
Empty list
To create a list with no items, click on Drag Create new list from Variables onto the Workspace.
Specify a variable name for the List and save it.
An empty list is registered as a variable.
List with items
Drag Set Variable Action from Variables onto the Workspace.
Specify the variable name in Variable and the list in Value.
The Value is enclosed in %, which means formula, and [], which means list.
Then, in [], specify the items separated by ,.
For example, to set 10, 20, and 30, specify %[10,20,30]%.
The following structure is set in the variable list.
The index is a sequential number starting from 0 and is used to manipulate items.
Index | Value |
---|---|
0 | 10 |
1 | 20 |
2 | 30 |
In the previous example, we set a numerical value, but if it is a string, enclose it further with ''.
For example, to set ABC, EFG and HIJ, specify %['ABC','EFG','HIJ']%.
The following structure is stored in the variable list.
Index | Value |
---|---|
0 | ABC |
1 | EFG |
2 | HIJ |
Create text by splitting it with a delimiter character
Use the Split text Action.
Operations on already existing List
Add
To add an item to a list that has already been created
Drag Add item to List Action from Variables onto the Workspace.
Specify the value to be added in Add item and the target list variable in Into list.
New item is added to the end of the list.
Get the count of items
Specify %List.Count%.
For a list with 5 items (indexes 0-4), 5 is the result.
Get item
Specify %List[Index]%.
To get the first value from the list below, use %List[0]%.
Index | Value |
---|---|
0 | 10 |
1 | 20 |
2 | 30 |
If 1 is specified for the Index, the result is 20, and if 2 is specified for the Index, the result is 30.
Get the last item
Specify %List[List.Count-1]% to get the tail.
Delete
There are two ways to do this: by specifying an Index or by specifying a value.
In either case, first drag the Remove item from list Action from Variables onto the Workspace.
For example, delete the index 1 item in the following list.
Index | Value |
---|---|
0 | 10 |
1 | 20 |
2 | 30 |
Deletion results are listed below.
Index | Value |
---|---|
0 | 10 |
1 | 30 |
After deletion, the Index will be packed.
Specify index
Select Index in Remove item by.
Then, specify the index to be deleted in Index and the target list in From list.
Specify value
Select Value in Remobe item by.
Then, specify the value to be deleted in Value and the target list in From list.
If Remove all item occurrences is OFF, the first matching item (lowest number) will be deleted.
When Remove all item occurrences is ON, all matching items will be deleted.
Shuffle list. Randomly reorder items in the list.
Drag Shuffle List Action from the Variables to the Workspace.
Specify a list variable for List to shuffle.
When this action is executed, the order of the items is randomly reordered.
The result will change each time it is executed.
Sort list. Sort items in the list in ascending order.
Drag Sort List Action from Variables onto the Workspace.
Specify a list variable for the List to sort.
Reverse list.Sort list items in descending order
Drag Reverse List Action from Variables onto the Workspace.
Specify a list variable for the List to reverse.
Remove duplicate items from list.
Drag Remove duplicate Items from list Action from Variables to the Workspace.
Specify a list variable for the List to remove duplicate items to from.
If the target list is ['abc', 'efg', 'abc', 'efg', 'ABC'] and
case-sensitive, ['abc', 'efg', 'ABC'], and
If case-insensitive, the result is ['abc', 'efg'].
Converts elements to text by combining them
Use Join Text Action.
Match the two Lists
Find common list items
Extract items common to the two lists.
Drag Find common list items Action from Variables onto the Workspace.
Specify variables for First list and Second list, and Specify the resulting list variable in the Variables produced.
If the resulting list variable does not exist, a new one is created.
If you specify [0, 30, 50, 90] and [10, 20, 30, 40, 50] in the list The common [30, 50] is stored in the variable IntersectionList.
Marge lists
Add a second list to the end of the first list.
Drag Marge lists Action from Variables onto the Workspace.
Specify variables for First list and Second list, and Specify the resulting list variable in the Variables produced.
If the resulting list variable does not exist, a new one is created.
If the listings [0, 30, 50, 90] and [10, 20, 30, 40, 50] are specified, then A second list is added after the first one. [0, 30, 50, 90, 10, 20, 30, 40, 50] will be stored in the variable OutputList.
Subtract lists
Deletes items existing in the second list from the first list.
Drag Subtract lists Action from Variables onto the Workspace.
Specify variables for First list and Second list, and Specify the resulting list variable in the Variables produced.
If the resulting list variable does not exist, a new one is created.
If the listings [0, 30, 50, 90] and [10, 20, 30, 40, 50] are specified, then [0, 90] will be stored in the variable ListDifference.
Clear list
Delete all items on the list.
Drag Clear lists Action from Variables onto the Workspace.
Specify a list variable for the List to clear.
For those who want to learn Power Automate Desktop effectively
The information on this site is now available in an easy-to-read e-book format.
Or Kindle Unlimited (unlimited reading).
You willl discover how to about basic operations.
By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.
Discussion
New Comments
No comments yet. Be the first one!