Array. Data type of the variable.(Power Automate Cloud flows)
A variable is an item used in programming that is like a box in which data is named and stored.
They can store a variety of data with certain restrictions.
The ability to utilize these variables makes a big difference in what you can do with Power Automate.
An array is a type of variable that handles a collection of variables (items). They are also called list or collection.
How to use
Initialize variable
In order to use variables, they must be initialized.
To do so, select the "Variable" connector under "Built-in" when adding a step to the flow.
Select "Initialize variable" from the "Actions" menu.
Set parameters.
Parameter | Value | Description |
---|---|---|
Name | array | Arbitrary variable name. |
Type | Array | Select "Array". |
Value | ["A","B","C"] | The contents of the first variable to be specified. It may be unset. If unset, the content of the variable will be an array with no items. |
Arrays are set to values separated by , in [].
Specifying the following will set the variable to an array with A, B, and C as its items.
["A","B","C"]
Index | Item |
---|---|
0 | A |
1 | B |
2 | C |
The index is a number used to access the element
The value to be stored can be either a number or a string.
However, within a single variable, either one should be used.
For strings, it is necessary to enclose the element in " ", but this is not necessary for numbers.
[1,2,3]
Index | Item |
---|---|
0 | 1 |
1 | 2 |
2 | 3 |
Append to array variable
The "Add to Array Variable" action adds an item to the end of the array.
When using this action, no " is needed, even for strings.
Access to item
All items
Specify the array variables in "Select an output from previous steps" in "Apply to each".
The actions in "Apply to each" are then repeated for the number of items in the array variable.
You can use the dynamic content "Current item" in it to retrieve the items.
One specify item
To retrieve a single item, specify an expression as follows.
Change the red text as necessary.
variables('Variable name')[Index]
Index is sequential number starting from 0. For an array of ["A", "B", "C"], the index would look like this
Index | Item |
---|---|
0 | 1 |
1 | 2 |
2 | 3 |
Reinitialize array
If you want to replace an array in the middle of a flow, use the Use the "Set Variable" action in the "Variables" connector.
Array with items
If you want to replace an array in the middle of a flow, use the Use the "Set Variable" action in the "Variable" connector.
["Z"]
Empty array
If you want to set it to an array with no items, specify only [].
The first time you initialize it, it was blank, but you specify it differently in "Setting Variables".
For those who want to learn Power Automate Cloud flow 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 Cloud flow to streamline your workflow.
Discussion
New Comments
No comments yet. Be the first one!