Showing results for 
Search instead for 
Did you mean: 
tutankh Advocate II
Advocate II

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?

ManishJain Helper V
Helper V

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
Super User

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!

Helpful resources


New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!


Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (9,898)