web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Updating a Collection ...
Power Apps
Answered

Updating a Collection after a Patch

(0) ShareShare
ReportReport
Posted on by 329

Good evening. So far for my inventory app, I've been able to speed up performance dramatically by caching reference data that come from tables in my Azure SQL Database. A great tutorial for this is on @Meneghino page (i think its him) and it really helped. 

 

I used this formula to create my Collection in the OnStart property:

 

ClearCollect(CollectionName, '[dbo].[TableName]')

 

But what if I wanted to update a Collection after I Patch a record? How would I go about doing that? Would the following work

 

1. User clicks "Update Button"

2. Update Button does this:  

 

Patch('[dbo].[TableName]', First(Filter('[dbo].[TableName]', Id = Value(InspectId.Text))), {Base: DataCardValue12.Selected.Value, Location: DataCardValue44.Selected.Value, Unit: DataCardValue15.Selected.Value, Status: DataCardValue43.Selected.Value}); SubmitForm(EditItemForm) ClearCollection(CollectionName, '[dbo].[TableName]')

Does that significantly increase the amount of time the app has to save a record, update collection, load screen, display screen?

 

Brendon

 

Categories:
I have the same question (0)
  • Verified answer
    Meneghino Profile Picture
    6,949 on at

    This is a start for iprovmement, and yes it is me...

    Please note particularly how to refer to a record to update in the second argument of the Patch: you only need the primary key value(s) to identify a record uniquely...  It saves at least one read operation

     

    Patch(
     '[dbo].[TableName]',
     {Id: Value(InspectId.Text)},
     {
     Base: DataCardValue12.Selected.Value,
     Location: DataCardValue44.Selected.Value,
     Unit: DataCardValue15.Selected.Value,
     Status: DataCardValue43.Selected.Value
     }
     );
    
    ClearCollect(CollectionName, '[dbo].[TableName]')
  • BrendonBrooksP1 Profile Picture
    329 on at

    Thank you. That worked magically. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 339 Most Valuable Professional

#2
11manish Profile Picture

11manish 180

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard