All Content
Timespan
explore our new search
How to Use Power Apps Patch Function
Power Apps
Feb 15, 2023 2:15 PM

How to Use Power Apps Patch Function

by HubSite 365 about Darren Neese (PowerApps Tutorial)

Power Apps Trainer at Neeseus

Citizen DeveloperPower AppsLearning Selection

The Patch function is one of the most important functions to master when working with Power Apps. It allows you to add or update records within your data source

The Patch function is one of the most important functions to master when working with Power Apps. It allows you to add or update records within your data source. At some point you’ll realize the form control is a limiting factor within your Power Apps development efforts. You’ll start to see scenarios within your application where a form control just doesn’t cut it. You may need to do some inline editing with a gallery. I like the Patch function so much more than a form control, that I just don’t use the form control anymore. So, stick around all the way through this video and I’ll show you all the ins and outs of using the Patch function and I’ll show you all the cool ways I use it.

The Power Apps Patch function is used to update data in a data source, such as an Excel table, SharePoint list, or SQL database. It allows you to modify existing records and create new ones without having to write any code. This makes it easy for non-developers to quickly make changes and keep their apps up-to-date. The Patch function also enables more sophisticated scenarios like creating parent/child relationships between tables, updating multiple related records with one action, and automatically generating unique IDs for newly created records. To use the Patch function in Power Apps:

  • 1) Select the Data tab from the left navigation bar of your app canvas
  • 2) Click on Create New Connection if you need to connect to a new data source
  • 3) Select Add Data Source from the options that appear
  • 4) Find your desired connection type (e.g., Excel file or SharePoint list), select it, then enter its associated credentials when prompted
  • 5) Once connected, open the Advanced Editor by clicking on View > Advanced Editor in the ribbon menu at the top of your screen
  • 6) Enter your desired patch command into this editor using standard syntax (see Microsoft's documentation for detailed instructions). Be sure to specify both what record(s) you want updated as well as what values they should take on after being patched
  • 7) When finished entering commands into Advanced Editor click Done and run your app

Questions and Answers about Power Platform/Power Apps

And on select of this button is where i would like to call the patch. Function. The syntax is patch

Use the Update function to replace an entire record in a data source. In contrast, the UpdateIf and the Patch functions modify one or more values in a record, leaving the other values alone. For a collection, the entire record must match. Collections allow duplicate records, so multiple records might match.

You can use the power Apps patch function to modify or create a set of records in a data source based on a collection. You can use the collect function to collect data from a collection to a data source, but the collection must have the same names as the columns in the data source.