Change The Values In A Record (Patch)
Change The Values In A Record (Patch) Input collection: myInventory33 ID Name Quantity 1001 Desktop PC 10 1002 Monitor 23 1003 Laptop 16 Output collection: m...
- Published
- Reading time
- 1 min read
Before you start
Is this guide for you?
- Best entry point
- Power Apps
- Time investment
- 1 min read
Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/powerapps-collections-cookbook/change-the-values-in-a-record-patch/. Author: Matthew Devaney.
Change The Values In A Record (Patch) Input collection: myInventory33 ID Name Quantity 1001 Desktop PC 10 1002 Monitor 23 1003 Laptop 16
Output collection: mySolution33a (update ‘Monitor’ quantity to 18) ID Name Quantity 1001 Desktop PC 10 1002 Monitor 18 1003 Laptop 16 Solution code: //Create a collection
ClearCollect(myInventory33, { ID : 1001 , Name : "Desktop PC" , Quantity : 10 }, { ID : 1002 , Name : "Monitor" , Quantity : 23 }, { ID : 1003 , Name : "Laptop" , Quantity : 16 } ); //Change the value in a cell code
ClearCollect(mySolution33a,myInventory33); Patch(mySolution33a,LookUp(mySolution33a,ID= 1002 ),{ Quantity : 18 }); Code language: JavaScript ( javascript )
Output collection: mySolution33b (update multiple values for ID 1003) ID Name Quantity 1001 Desktop PC 10 1002 Monitor 23 1003 Surface Laptop 33 Solution code: //Create a collection
ClearCollect(myInventory33, { ID : 1001 , Name : "Desktop PC" , Quantity : 10 }, { ID : 1002 , Name : "Monitor" , Quantity : 23 }, { ID : 1003 , Name : "Laptop" , Quantity : 16 } ); //Change multiple values in a row code
ClearCollect(mySolution33b,myInventory33); Patch( mySolution33b, LookUp(mySolution33b,ID= 1003 ), { Name : "Surface Laptop" , Quantity : 33 } ) Code language: JavaScript ( javascript )
Tagged
Patch · Power Apps
Have a Microsoft 365 topic idea?
Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.
Keep learning Microsoft 365
Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.
Continue learning
Related tutorials
Related questions
Related comparisons
Next action