Showing results for 
Search instead for 
Did you mean: 
Advocate III
Advocate III

Apply to each loops, variables, and parallelism

I have a flow which triggers from an email receipt that contains an HTML table.

The goal of the flow is to take the html table, convert it to JSON, then loop through each object, validate data, and send out http requests for certain entries.


The basic process for this is to:


  1. Get the headers from the [0] index position
  2. create an array for all json objects
  3. For each object where the index > 0, ---
    1. create a blank json object
    2. create an array with items from each 'cell'
    3. loop through the array of index numbers of the header row
      1. create a property:value pair
      2. add the property:value pair to the json object
    4. Add the json object to the 'all objects' array
  4. Do stuff with the json array

My issue is that due to certain restrictions, my loops seem to be taking a long time to complete for the amount of objects I have. Specifically, I can't instantiate a variable within a loop, and I can't update a variable with a value that includes the original variable (ex. set variables('AA') = union(variables('AA'), json{"Property":"1})


I checked, just to be certain, and running in parallel causes all kinds of mayhem since the variable objects are global and get updated and pulled as such.


Anyone have any thoughts here? Or am I stuck at present with slowness for the sake of treating data accurately?


Any thoughts for getting around this?

Solution Specialist
Solution Specialist

Re: Apply to each loops, variables, and parallelism

Hi , 


Instead of using Set variable inside loop use compose action. the expression that you are using to set variable can be used in compose as well. 


Ref :



Super User III
Super User III

Re: Apply to each loops, variables, and parallelism

Hello @tutankh

Please share a screenshot of your flow

If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up

Proud to be a Flownaut!

Check out my blog for Power Automate tips, tricks, and guides

Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,224)