web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Modifying a single ele...
Power Automate
Answered

Modifying a single element of an array

(0) ShareShare
ReportReport
Posted on by 3

I'm trying to use an array, defined in an Initialize variable as [10,25,86,43,22].  I'd like to be able to modify the individual elements of this array.  For instance, how do I increment element 3 by 1, so that the array is now [10,25,87,43,22]?

Categories:
I have the same question (0)
  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @Josh1,

     

    There is no direct action and Expression in Flow to change an element of an array currently.

    If you want to function that you mentioned to be supported in Microsoft Flow, please submit an idea to Flow Ideas Forum:

    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

    In addition, I use a series of variables to change a certain element, the process is more cumbersome, there may be a better way, but you could refer to this method first:

    The general idea is to manually add an index to the array, then change the array element corresponding to the specified index, empty the previous array, and add the new element.

    Array-Test:     the initial array

    Array-Index: create an index

    Array-Tran:   As a transition, store the Test array elements and Index, one-to-one correspondence.

    Traverse the array-Tran and add the Value as a new element of the Test array.

    If the index is equal to 3, need to add 1 to Value by using add() function.

    Image reference:

    21.PNG

    Apply_to_each:

    22.PNG

    Apply_to_each 2:

    23.PNG

    Finally, you could output an array to see if the result is correct.

    Please take a try.

     

    Best Regards,

    Barry

  • Alphie Profile Picture
    48 on at

    (4 years later) Is this still the best method to update a single value in an array?

  • takolota1 Profile Picture
    4,980 Moderator on at

    @Josh1 @Alphie @v-bacao-msft 

     

    Couldn’t you just use a single compose action & a combination of join( ), take( ), & skip( ) expressions?

     

    So something like 

    @join(take(InsertArray, 3), ','),
    InsertNewValue,
    @join(skip(InsertArray, 4), ',')

    inside a Compose action. Then use a split(outputs(‘Compose’), ‘,’) to re-form the array with the new value.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard