This is part 3 of our SharePoint App, and we got over many different ways to Patch. When you start writing your Patch statements you should think of it like a Power Automate,
What is your Trigger? Is it a Button Click, is it the OnChange property? What causes the Patch?
Then you should think about the Action, are you Patching Everything? Do you want a Collection and ask the users with a popup, if this is what they want to Patch? Do you want to Patch just 1 Line Item? Do you want to Patch each Column individually?
These options are all up to you, and depend on your UX of your app.
The Patch function in Power Apps can be used to create, update, or merge records in a data source or a record variable². There are different ways to use the Patch function depending on your needs¹.
Some examples are:
Patch( Customers, Defaults( Customers ), { Name: "Contoso" } )
²
Patch( Customers, First( Filter( Customers, Name = "Contoso" ) ), { Phone: "555-1212", City: "Seattle" } )
²
Set( ResultRecord, Patch( Customers, Defaults( Customers ), { Name: "Contoso" } ) )
¹
Collect( Customers, { Name: "Contoso", Phone: "555-1212", City: "Seattle" }, { Name: "Fabrikam", Phone: "555-3434", City: "New York" } )
¹
Power Platform Community · Shane Young · Apr 10, 2018
I know I need an OnSelect collect action for the toggle and a Patch on a button. ... Message 3 of 10 ... @gabibalaban, and what should the PATCH look like?