07-03-2019 10:22 AM
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 } ) ) )
Find out more about Pragmatic Works training and consulting by going to http://www.pragmaticworks.com
watch?v=Qp458n1q2bo