cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
hpkeong
Level 10

Useful features of powerapps (15) - Multiple (Batch) Records Adding / Editing

Hi

 

With new formula, Patch (in Batch or Multiple Records) and ForAll, Apps' efficiency can be enhanced tremendously, esp. for those really need these.

 

After couple of advices and information/guide from PG Staff (rgruian), and Mr. Dang, (Thanks to both of them), I wish to share as compliment to Tutorial on Patch

 

Original Text: Modify or create a set of records in a data source

 

Patch can also be used to create or modify multiple records with a single call.


Instead of passing a single base record, a table of base records can be provided in the second argument. Change records are provided in a table as well, corresponding one-for-one with the base records. The number of records in each change table must be the same as the number of records in the base table.


When using Patch in this manner, the return value is also a table with each record corresponding one-for-one with the base and change records.

 

Patch( DataSource, BaseRecordsTable, ChageRecordTable1, [, ChangeRecordTable2, … ] )

 

NB: ChangeRecordTable1, Table2,.... can be achieved thru the use of ForAll (however, if fix number of fields / rows are known, gallery may not be necessary; I have not included here as it is pretty simple to understand)

 

Patch has been the key formula since Jan 2016 and further improved in Apr 2016.

What is really unclear and found ambigous for me is: BaseRecordsTable & ChangeRecordTable

- BaseRecordsTable: Can be obtained thru creating a Context Variable (using Collect, or even other method such as UpdateContext, or Navigate( .., .., {AA: ..}).

- ChangeRecordTable1, 2,...: Can be obtained thru ForAll(Gallery.AllItems, {FieldTitle1: TextInput1.Text, FieldTitle2.Text,..}

 

By sharing here, and while awaiting Tutorial being improved on Patch (Multiple Records) [ForAll is pretty clear and explicit], I hope for those who are in needs and as slow in learning as me, can use this as a reference.

 

Hopefully my examples can further be improved. Thanks in advance.

 

Example shown here are a combination of:

- New Multiple Records saving, and

- Multiple Records editing and saving

using the SAME editing gallery.

[I use Excel in DropBox as datasource and the speed of saving, editing,...is par with CDM / CDS]

 

My apologize: Correction of Errors

1. Collect(TableBookCollection,.......) shall be Collect(SourceBook......)

[the formula is correct, just the description was not properly edited]

2. Gallery1.Items.SourceBook shall be changed to Gallery1_3.Items.SourceBook

[Typo Error]

 

Screenshot (32).pngEditing Existing RecordsScreenshot (35).pngAdding New Records

 

 

Have a nice day.

hpkeong
1 REPLY 1
Urvi
Level: Power Up

Re: Useful features of powerapps (15) - Multiple (Batch) Records Adding / Editing

Patch function is not taking second argument as "table". can you please help?

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,845)