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 / Create Array and Add I...
Power Automate
Answered

Create Array and Add Items to Array without Initialize and Set Commands

(0) ShareShare
ReportReport
Posted on by 75

Is it possible to create a new array and add items to it inside of just a ApplyToEach loop?  I can't use initiate and set variable commands because I am attempting to use the parallel processing of ApplyToEach. I'd like to run 50 items at a time. 

 

My use case is to assemble an array inside of the loop which has different case statements with different commands. When the loop is complete I will add the array to an email notification. Here is the example. MembersMail1 would be the array. Then I would like to add values to it inside of the switch/case statements.

 

I'm open to other ideas too if anyone has them. For example a comma delimited string of values would also work for me.  Or a JSON object. I'm not sure how to implement either.

 

robcaretta_1-1626372228471.png

 

Categories:
I have the same question (0)
  • PrasadAthalye Profile Picture
    on at

    You can use Append to an array variable under every switch and finally use the variable in send an email.

     

    PrasadAthalye_0-1626379084109.png

     

  • robcaretta Profile Picture
    75 on at

    @PrasadAthalye- I have an additional ApplyToEach loop above the member loop with parallel processing. There will not be a single array due to parallel processing. I would like to create 50 dynamic arrays, and update each within their localized loop context.

    The problem with the variable initialization is it must happen at the root of the flow. If you set values back to this array variable it's just a single instance. That wouldn't work with parallel processing.

     

    Hope this makes sense. I'm just trying to find out if this is even possible. 😀

  • Verified answer
    PrasadAthalye Profile Picture
    on at

    Is it not possible to use one array and add objects to elements that you can filter under each branch? You can always use filter array. I think all that you need is elements.

  • robcaretta Profile Picture
    75 on at

    I think I understand. So one giant array or JSON object with additional parameters. Then filter that back down to the localized loop. That may work. Thank you for the idea!

  • jaredbidlow Profile Picture
    256 on at

    Seems hard to implement in practice. Do you have to add an index to each object? What are the steps to do this?

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard