chunk function. Collection.(Power Automate Cloud flows)

Japanese version.

The chunk function divides an array into multiple arrays of equal size.

The chunk function has a string function of the same name. It divides a single text into multiple texts of equal size.


chunk('<collection>', '<length>')
collectionRequired fieldSpecifies the array to split.
lengthRequired fieldSpecifies the size of the division.

How to use

In many cases, it is used to initialize or set variables of type "Array".

Clicking on chunk in the "Expression" tab sets the function name and () in the formula field.

If you see something like the following, your settings are complete.

You can change the contents of the function by clicking on the purple icon.

When dynamic content or variables are used in expressions, special specifications are required.

(How to get dynamic content with expressions.)

Examples of arguments and results

For example, we have an array with 9 items. The variable name is "srcArray".


Divide "srcArray" by 3 in length.


The result is a two-dimensional array with an array within an array.

[ [1,2,3] , [4,5,6] , [7,8,9] ]

The "length" need not be divisible by the number of items in the "collection.

A "srcArray" with 9 items can be divided by length 5.


The result will be an array like this The last number of items is cut off in the middle and becomes 4.

[ [1,2,3,4,5] , [6,7,8,9] ]

How to use the results.

The result of this function is a two-dimensional array with an array. within an array..

For example, let the variable name be "dstArray".

The result set in "dstArray" is as follows.

[ [1,2,3] , [4,5,6] , [7,8,9] ]

Set this "dstArray" to "Select an output from previous steps" in "Apply to each".

It is easier to handle "Apply to each" if it is renamed.

In this example, the first "Apply to each" is repeated three times.

The "current item" of dynamic content would look like this.

  1. [1,2,3]
  2. [4,5,6]
  3. [7,8,9]

In the first "Apply to each."

For the second "Select an output from previous steps", set the "Current item" in the first "Apply to each".

This will now repeat down to the individual items.

The "current item" in the first "Apply to each" is the array. currently being repeated.

The "current item" in the second "Apply to each" is the individual item.



Collection Functions(Power Automate Cloud flows)