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.
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.