Using the Patch Command in Power Apps for Parent Child Table Inserts [Episode 32]

preview_player
Показать описание
in this tutorial, you'll learn how to use the Patch command to take the primary key value from inserting into one table and inject it into a second table. This example is perfect for apps like shopping carts or inventory systems.

Here's the code:

ClearCollect(
colStageCustomer,
Patch(
'[dbo].[Order]',
// Defaults('[dbo].[Order]'),
{OrderID:Blank()},
{
CustomerName: inpCustomerName.Text,
OrderDateTime: Now()
}
)
);

ClearCollect(
colStageOrderLine,
ForAll(
colOrderLineItem,
Patch(
'[dbo].[OrderLineItem]',
{OrderLineItemID: Blank()},
{
OrderID: First(colStageCustomer).OrderID,
ProductID: ProductID
}
)
)
)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -

Next step on your journey:

Let's connect:

Pragmatic Works
7175 Hwy 17, Suite 2 Fleming Island, FL 32003
Phone: (904) 413-1911

---------
Рекомендации по теме
Комментарии
Автор

Where can I find the video where the collect " colOrderLineItem " was created? I've followed all the steps since my scenario is exactly the same (SQL - two tables, parent/ child, ) but I'm missing that piece of information to fully understand the solution. Thanks

blaschkesita
Автор

Thank you for the video, it's really cool to have so many options to achieve this. I am using sharepoint in my apps (have no access to real database engines) so I am doing this via Flow, sending the parameters from powerapps.

tenisviejos
Автор

Thanks for the video, I am using Azure SQL DB where I wanted to edit customer details and item details all in one screen once changes made need to be updated on different DB. Is it Possible?

ashwinidas
Автор

where the colStageCustomer and colStageOrderLine collections created before? Where do they come from? Can you pls clear that part? Than you.

hizke
Автор

The data is stored in Azure, is it SQL Server or what is it?
Why don't you use SharePoint Lists in your examples?
Why do you prefer a database?

calbertop
Автор

I have a sharepoint list with multiple row, one of the column is a list of communications. One of the other column is call 'Seen by' that will be fill with a 'x' when the communication is seen. How with a onselect button i could add the 'x' in the SeenBy column base on the communications select in a listbox in my app? Thanks a lot

guillaumechandonnet
Автор

How can I do this for sharepoint list?

leonghz