cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tlevine
Level 8

Bulk Update Records Using Concurrent and Patch

Hi All - 

 

I am having some issues with the the code below causing delays in the app functionality. Any thoughts on how I can improve it?

 

Concurrent(UpdateContext({WaitingMessage: true}),
ForAll(
AllRAWDATA,
If(
'Review Status' <> "NULL",
Patch('[dbo].[Slow_Moving_Raw_Data]',
{'Review Status': "Complete"})
));
Refresh('[dbo].[Slow_Moving_Raw_Data]')
);
ClearCollect(
AllRAWDATA,
'[dbo].[Slow_Moving_Raw_Data]'
);
UpdateContext({WaitingMessage: false}); Navigate(ScrSuccess, Transition.None)

2 REPLIES 2
Super User
Super User

Re: Bulk Update Records Using Concurrent and Patch

@tlevine 

How much data are we talking about here?  Are several hundred lines being patched?  It would be great to know a little bit more about your app's purpose.

 

Using PATCH and UPDATE to insert new records into a database just takes time.  They are very resource intensive functions and writing records to a database is one of the most "expensive" tasks you can do in terms of performance.

 

I have an untested idea (these are the most dangerous type lol).  I wonder what would happen if you sent the collection to Flow and had it do the work instead.  When the task is done it could return a variable saying "success" or "failure".  My question would be though: does the Flow work asynchronously from PowerApps?  If yes, the user could browse the apps while waiting for to upload.

 

Link to MS Blog Post

https://flow.microsoft.com/en-us/blog/return-data-to-powerapps/

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
tlevine
Level 8

Re: Bulk Update Records Using Concurrent and Patch

Interesting idea! The number of items that are patched at a time will vary dependent upon a few factors but I can roughly estimate that each time there may be 20-50 items patched. The data that I am trying to patch is stored in a collection and updated in the collection until the "Save All" button is submitted

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,561)