How to Bulk Update SharePoint Data in Power Apps: Patch vs UpdateIf vs ForAll

I was asked about bulk updating SharePoint data, so I decided to conduct a performance comparison test.

スポンサーリンク

What I Tested

In this experiment, I attempted to bulk update a string column in a SharePoint list containing over 500 items.
Important: Since the default [Delegation Limit] is set to 500, only the first 500 records were updated
I compared the following three functions for bulk updates:

  • Patch
  • UpdateIf
  • ForAll

Results: The Patch function proved to be the fastest method for bulk updating SharePoint lists

UpdateIf

First, let’s examine UpdateIf. The expression looks like this:

 UpdateIf('501sample', true, {s:"a"} ); 

While the formula is straightforward and relatively simple to implement, it takes approximately 1.5 minutes to complete updates for 500 records.

Patch

Next, let’s look at Patch. The formula is structured as follows:

 ClearCollect(target, '501sample'); // All data is acquired on the Power Apps side UpdateIf(target, true, {s:"b"} ); // Update all the data on the Power Apps side at once with UpdateIf Patch('501sample',target); // Apply all at once with Patch 

The results are impressive: completing 500 updates in approximately 20 seconds.

ForAll

Finally, let’s examine ForAll. Here’s the expression:

 With({target:'501sample'}, ForAll(target, Patch('501sample',ThisRecord, {s:"f"}); ) ); 

The performance was better than expected, taking about 1 minute and 10 seconds for 500 updates.

In conclusion, the batch update method using Patch proved to be the fastest approach.

However, it’s important to note that these results might differ when using Dataverse as the data source, since UpdateIf supports delegation in that context. We’ll explore this scenario in our next article.

Related Articles

Copied title and URL