I was asked about bulk updating SharePoint data, so here’s a note on how to do it. I also did a performance comparison.
What we tried
In this case, I tried to batch set values in a “string” type column for a SharePoint list with more than 500 items.
*Setting [Data Row Limit] is still 500, so the first 500 items are updated.
*Setting [Data Row Limit] is still 500, so the first 500 items are updated.
The following three functions were compared.
- Patch
- UpdateIf
- ForAll
Conclusion: Patch is faster for bulk updating SharePoint lists.
UpdateIf
First, UpdateIf. The expression looks like this.
UpdateIf('501sample', true, {s:"a"} );
The formula is simple and not bad, but it takes about 1.5 minutes to update 500 cases.
Patch
Then Patch. The formula looks like this.
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
Here are the results: 500 updates in about 20 seconds.
ForAll
The last one is ForAll. the expression looks like this.
With({target:'501sample'}, ForAll(target, Patch('501sample',ThisRecord, {s:"f"}); ) );
Surprisingly good fight, about 1 minute and 10 seconds for 500 updates.
So the conclusion was that batch updating with Patch was the fastest way.
However, if the data source is Dataverse, the result may change because UpdateIf can be delegated. This will be discussed in the next issue.