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
Solved! Go to Solution.
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]')
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]')
Thank you. That worked magically.
User | Count |
---|---|
253 | |
106 | |
88 | |
51 | |
43 |