Loops and data operations
1. Loops and data operations
What happens when a connector returns a list, like ten emails, fifty SharePoint items, or a hundred form responses? You loop through it, then filter, reshape, and combine the results into whatever you need next.2. Apply to each
Apply to Each is how you process a list. Give it an array of ten emails, fifty SharePoint items, or a hundred delivery records, and it runs the actions inside the loop once for each item. Inside the loop, you reference Current item to get the value for that specific iteration. By default the iterations run sequentially, one after another. You can turn on Concurrency control in the loop's Settings to run them in parallel, which is faster. But parallel runs that update shared variables can race and overwrite each other, so stick with sequential unless you've thought through the side effects.3. Current item
The key concept inside any loop is Current item. It holds the value for this specific iteration, not the whole array. On the first pass it's item one, on the second pass it's item two, and so on. You access it from the Dynamic content panel under the Apply to Each action. The most common loop mistake is referencing the full array variable inside the loop instead of Current item. That gives you the whole list every time, not the individual item.4. Filter before you loop
Instead of checking a Condition inside the loop, use Filter Array first. The filter narrows the list before the loop starts, so only matching items enter. With 500 tickets a day where 12 are Urgent, filtering first means just those 12 reach Apply to each.5. Less work per run
Without Filter Array, Apply to each runs 500 times, with a Condition inside firing 500 API calls. With Filter Array, the filter checks each item once, then the loop runs just 12 times. Same outcome, a fraction of the cost.6. Filter array action
The Filter array action takes two things. From, which is the array you want to filter, and Filter Query, which is a single condition row that looks just like a Condition action. On the Left, use the item expression like item-question mark-Status to read a field from each item. The output is called Body, which is the full filtered array.7. Body, not Body Item
The picker shows two outputs, Body and Body Item. You want Body, the full filtered array that the loop should iterate over. Body Item is just a single record, and if you pick it the loop runs only once and you lose the filtering work.8. Do Until
While Apply to Each processes every item in a known list, Do Until is different, because it repeats actions until something changes. The key distinction is that Do Until is not for iterating over arrays. If you have a list, use Apply to Each. Use Do Until for polling patterns where you wait for a job to finish, or for retry patterns where you keep trying a request until it succeeds. And always set a count limit to prevent infinite loops in case the condition never becomes true, since the default is 60 iterations.9. Data operations
Power Automate gives you four data operations for transforming arrays. Select reshapes each item, so if your records have ten fields, Select extracts just the two you need, and the array still has the same number of items, just smaller. Join combines every item into a single string with a separator, so three project names become one comma-separated line, perfect for an email subject. Create HTML table converts an array into a formatted HTML table ready to drop into an email body, while Create CSV table produces comma-separated values for Excel or for exports. The combination you'll reach for most is Select followed by Create HTML table, since that pair turns any array into a clean, readable email report.10. Let's practice!
Now it's time to loop through a list, filter the results, and see data operations transform your arrays.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.