Enjoy faster startup times with the new Concurrent function

Do your apps pre-load a bunch of data when they start, typically in the OnStart formula? Collect, after Collect, after Collect, loading up tables of data so that when your user interacts with the app it is ready to go?

Until now, we did this by using the chaining operator ; (or ;; depending on your language) which would perform multiple actions in sequence. For example, if we wanted to pre-load some tables from the Adventure Works database in SQL Azure, we might have written:

If we watch this formula in action with a network monitor, we see this kind of pattern:

One at a time, the next one doesn't start until the last one is complete, one lane of traffic. What if we could have multiple lanes of traffic? What if we could perform these operations concurrently, in parallel?

Enter the Concurrent function. Take those exact same four ClearCollect calls above and place them within this function:

As with any parallel processing, the main thing to watch out for is dependencies between the formulas as we can't know which one will finish first and it might change from run to run. PowerApps will detect and report errors for dependencies that it can detect, for example reading and writing a variable. But dependencies can be subtle and undetectable if you are making service calls or running Flows that have side effects.

What is PowerApps?

PowerApps is a service for building and using custom business apps that connect to your data and work across the web and mobile - without the time and expense of custom software development.