Array. Data type of the variable.(Power Automate Cloud flows)

Japanese version.

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.

ParameterValueDescription
NamearrayArbitrary variable name.
TypeArraySelect "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"]
IndexItem
0A
1B
2C

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]
IndexItem
01
12
23

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

IndexItem
01
12
23

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".

---

Links

Introduction(Power Automate Cloud flows)