Patch and Collect comparison in PowerApps (2024)

Patch and Collect share some of the same functionality. Here we discuss what they have in common and when to use one over the other.

Patch and Collect in PowerApps - What's the difference?

Patch and Collect can both be used to add a record to a data source. Typically Patch is used to modify entire records or the values of specific fields in a record, however when used with the defaults function it behaves in a similar way to Collect.

The two following code blocks will both add the same record to the ExampleDataSource collection. An important difference is Patch can only add to an existing collection whereas Collect will create the collection if it doesn’t already exist. So use Patch to amend records in existing collections and Collect to define a new collection. Patch is also more suitable for amending a subset of fields in a collection.

Patching to a collection

Patch( ExampleDataSource, Defaults(ExampleDataSource), { FirstName: "Joe", Surname: "Bloggs", DOB: Text(01/01/1970,"[$-en-GB]dd/mm/yyyy","en-gb"), StreetAddress: "123 Auckland Street", Suburb: "Auckland CBD", City: "Auckland", Country: "New Zealand", JobTitle: "PowerApps Developer" })

Using Collect to add to a collection

Collect( ExampleDataSource, { FirstName: "Joe", Surname: "Bloggs", DOB: Text(01/01/1970,"[$-en-GB]dd/mm/yyyy","en-gb"), StreetAddress: "123 Auckland Street", Suburb: "Auckland CBD", City: "Auckland", Country: "New Zealand", JobTitle: "PowerApps Developer" })
Patch and Collect comparison in PowerApps (2024)
Top Articles
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 6163

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.