cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Richard-Eckler
Level: Powered On

For All not running in sequence

Hi.

I'm using a ForAll Statement on a Collection that has been sorted just how I like it.

The ForAll executes well, all records are accounted for, EXCEPT my output in no longer sorted how I want it and now my results are hardcoded in HTML.
My office ladies are upset that their Wonderfully formatted office reports are showing up, as 1 Doc, but results aren't printing in order.

I don't know what to do!!

Any ideas?

3 REPLIES 3
Super User
Super User

Re: For All not running in sequence

Hi @Richard-Eckler 

The reason for this behaviour is because PowerApps doesn't guarantee to run the statements inside a ForAll loop sequentially. For performance reasons, PowerApps can execute these statements in parallel to help speed up the processing time.  That's the reason why your output appears out of sequence. 

A workaround is to include a sort sequence value in your collection. Within your ForAll, you can Collect your row level results to a new collection, making sure to include the sort value.

To derive your final output, you can carry out a SortByColumns and Concat on this new collection.

The formula in this thread provides an example of how to apply this technique. You'll see how I added a column called SortCol to address this issue.

https://powerusers.microsoft.com/t5/Creating-Apps/Send-email-HTML-format-problem/td-p/121228

Hopefully, you'll get a gist of how you can use this technique to solve your problem.

If not, if you post some code here, we can point you in the right direction.

 

 

Community Support Team
Community Support Team

Re: For All not running in sequence

Hi @Richard-Eckler 

 

Could you please share more details of your situation?

Could you please reference the reply of the case @timl  support? The reply is very clearly, is it solve your issue?

If it works fine,please accept it as solution.

 

Best Regards.

Yumia

Highlighted
Richard-Eckler
Level: Powered On

Re: For All not running in sequence

I've yet to work on the solution.

I will reply when I know.  

 

thanks.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 180 members 5,060 guests
Please welcome our newest community members: