Tutorials/Power Automate/Build Arrays Faster in Power Automate: Three Techniques Compared
Power Automateintermediate

Build Arrays Faster in Power Automate: Three Techniques Compared

Collecting items into an array is a routine task in automation. The technique you choose—variables, compose, or the Select action—can drastically influence flow execution time.

NA
Narmer Abader
@narmer · Published June 3, 2026

Power Automate developers often need to gather individual items—such as records from a loop, query results, or computed values—into a single array for later processing. The way you build that array can vary, and not every approach performs equally. This article compares three common techniques: using a variable with an append action, collecting objects through the Compose action, and transforming items with the Select action. We’ll examine their performance characteristics and when each makes sense.

Scenario: Building an Invoice Items Array

Imagine you need to create an array of invoice line items from a list of order numbers. For our demonstration we generate 10 item identifiers and turn each into an object with three properties: InvoiceID, Product, and Qty.

InvoiceIDProductQty
INV-0001Product 11
INV-0002Product 22
INV-0003Product 33
INV-0010Product 1010

We’ll use the same base data ([ range(1,11) ]) for each method so the comparisons are fair.

Method 1: Using a Variable and Append Action

This is the most straightforward approach but often the slowest for large datasets.

Steps

  1. Initialize a variable – create a variable named arrInvoices of type Array with a default value of [].
  2. Add an Apply to Each – set its input to range(1,11).
  3. Inside the loop – use a Compose action to build the object for the current item.
  4. Append to Array Variable – add the output of the Compose action to arrInvoices.

The Compose action uses an expression like this:

textCompose: build invoice object
{
"InvoiceID": concat('INV-', formatNumber(items('Apply_to_each'), '0000')),
"Product": concat('Product ', items('Apply_to_each')),
"Qty": items('Apply_to_each')
}

The Append to Array Variable action then selects the Outputs of that Compose as the value.

Concurrency restriction

Loops that contain variable writes (like Append to Array Variable) cannot use concurrency control. This forces sequential execution and is the main reason this method lags behind the others.

Method 2: Composing Objects and Collecting Outside the Loop

Instead of writing to a variable on each iteration, this technique builds a temporary array of all iteration outputs by referencing them after the loop.

Steps

  1. Apply to Each – input range(1,11).
  2. Inside the loop – same Compose action to create the object (as in Method 1).
  3. Outside the loop – add a new Compose action with the following expression:
textCollect all iteration outputs
outputs('Compose_InvoiceObject')
  1. Enable concurrency in the Apply to Each settings (set the degree of parallelism to 50, for example).

Because the Compose inside the loop runs simultaneously in multiple threads, and we only read its outputs after the loop, this method runs significantly faster than the variable approach. The final array is the result of the outer Compose.

Method 3: Using the Select Action (No Loop)

The Select action transforms an array without needing an iterative loop at all. This is the fastest method when your transformation can be expressed as a direct mapping from input values.

Steps

  1. Add a Select action.
  2. In its From field enter range(1,11).
  3. In the Map section, define the output fields:
textSelect action mapping
InvoiceID : concat('INV-', formatNumber(item(), '0000'))
Product   : concat('Product ', item())
Qty       : item()

The Select action emits the final array of objects directly. No loop, no variable, no extra Compose. Power Automate processes all items in one pass, giving the best possible performance.

Performance at a Glance

MethodLoop RequiredConcurrency SupportApproximate Time (10 items)Time Trend with Larger Data
Variable & AppendYesNoSeveral secondsGrows linearly, slowest
Compose (collect outputs)YesYes~2 secondsGrows, but scale less
Select actionNoN/A<1 secondNearly constant relative

The exact durations depend on your region and flow environment, but the Select action consistently finishes in a fraction of the time of the others, especially as the number of records increases.

Understanding Concurrency Constraints

Power Automate’s Apply to Each loop supports parallel execution, but only if it contains no variable operations (read or write). Both the variable and compose methods use a loop, but:

  • The variable method cannot enable concurrency, so it is stuck with sequential execution.
  • The compose method avoids variable actions, so concurrency can be turned on, yielding a 3–5× speedup over the variable approach.
  • The Select action doesn’t need a loop at all, sidestepping the concurrency question entirely.

Common Pitfalls

  • Missing variable initialisation – Using Append to Array Variable on an uninitialised variable will cause an error.
  • Incorrect outputs() reference – When collecting outputs outside the loop, the action name in the expression must exactly match the Compose action inside (including spaces). Use dynamic content if possible to avoid typos.
  • Select action with complex logic – If you need to perform API calls, conditionals, or multi-step transformations per item, a loop is unavoidable. The Select action cannot call other action types.
  • Unintended single output – Using outputs('Compose_...') outside a loop when the Compose is not inside a loop returns only the last object, not an array.

Which Method to Choose

ScenarioRecommended Method
Simple transformation of a range or existing arraySelect action
Building array after performing actions inside a loopCompose (with concur.)
Need to conditionally add items to an array while in a loopCompose (or variable if compatibility required)
Very small array (e.g., fewer than 10 items) and simplicity > speedVariable method (acceptable)

For most routine array‑building tasks, the Select action offers the best performance and simplest design. When a loop is necessary, prefer the Compose method with concurrency enabled. Reserve the variable‑based approach for cases where you must modify the array dynamically inside the loop and cannot change the variable to a compose pattern.

References