CRUD Operations in Canvas App: Part II

| Faiza Umair

In this part of CRUD Operations in Canvas App series , we will see in deep of Create and Update operation.

We can perform Creation and Updation of record in Canvas App using Patch() function. Creation and updation of record(s) can also be achieved using SumbitForm() but it is out of the scope of this document.

We can create one or more record using Patch() function.

CREATION OF RECORD

We can create record in datasource using Defaults() function along with Patch() function. Datasource could be a collection or a table. Defaults() function is used to insert new record.

Syntax: Patch(*DataSource,Defaults(datasource),{ColumnName1:data ,ColumnName2:data,…..})

Toys (Table)

Add new record in table

Patch(Toys,Defaults(Toys),{Id:1,Name:"TeddyBear",Colour:"Red",ChildAge:2})
CRUD Operation 1
Updation Of Record

We can update record in datasource using Patch() function. Datasource could be a collection or a table. But to update the record we need that record in which we need to made update.

Syntax: Patch(*DataSource,Record,{ColumnName1:data ,ColumnName2:data,…..})

Toys (Table)
CRUD Operation 2
Patch(Toys,First(Toys),{ChildAge:10})
CRUD Operation 3

In the above example ChildAge changes to 10 . First(Toys) is that record in which we have to make changes. In the above example it took first record and update its ChildAge field.

Patch(Toys,LookUp(Toys,Colour="Red"),{Colour:"Purple"})
CRUD Operation 4


Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.


M
Chief Architect, Founder, and CEO - a Microsoft recognized Power Platform solution architect.

About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting