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

Notifications

Announcements

Community site session details

Community site session details

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

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
    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,974 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard