1 step to update an item in an array in Power Automate

What do you do when you have an array of data in Power Automate and you want to update just one item?

Generate an array

In this example I will generate an array of numbers using the following expression:

range(1,10)
1 step to update an item in an array in Power Automate
This will now generate the array when I run the flow.
1 step to update an item in an array in Power Automate
1 step to update an item in an array in Power Automate 1

So how about updating item 7 to 17?

I could imagine using Pieter’s method but there is an easier option. Just 10 minutes ago I was asked on the chat how I would approach this problem.

The question is easy. How to update an item in an array. This array could of course be an array given by another action and this array could contain objects. For simplicity sake, I’m going with the array of numbers. If you have objects, then the principle will be the same however.

Update an item in the array

All we need to do is use the select action.

This select action takes the array that we generated earlier in our Compose action and now within the Mapping part of the Select action we have to do the magic.

Update an item in the array
1 step to update an item in an array in Power Automate 2

The expression used above is:

if(equals(item(),7), add(item(),10), item())

So the above expression compares the items with the value that we can identify the right item with. Then we either return the original item back or we adjust the item value.

And that is it! Simple?


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. You can contact me using contact@sharepains.com

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading