Microsoft Office 365

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)
This will now generate the array when I run the flow.

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.

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?

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

Recent Posts

Create multi user real time apps in Power Apps

When multiple users edit data and you want your app to show real time data,…

2 weeks ago

Sort by Title in your Highlighted Content web part in SharePoint

Yesterday I was asked about how to sort Documents in the Highlighted Content web part…

2 weeks ago

Copy large files from SharePoint to Azure Blob Storage using Power Automate

When you try to copy large files from SharePoint to Azure Bob Storage with Power…

2 weeks ago

Sort an array by dates in Power Automate

When we use the Sort function to sort arrays in Power Automate, it is soo…

3 weeks ago

New! Format data by examples in Power Automate

This feature "Format data by examples" will kill one of my most popular posts! How…

1 month ago

Named formulas in Power Apps using App.Formulas

Do you use the App onstart to set a lot of variables? And then do…

1 month ago
%%footer%%