Creating Invoices from Purchase Orders with a Button

Hi, I just moved from Notion to Coda and I am setting up a simple inventory and invoicing system. And I want to create a button that will create invoice rows based on the purchase order rows.

At this moment, I have five tables: [Inv.] [Order Detail] [Orders] [Invoice Detail] and [Invoices].

[Inv.] is just a list of items I have in inventory.

In [Order], there is [ORD#] and [Items] which is the table [OrderDetail].

In [OrderDetail], I have [Order] that is related to [ORD#], and [Items] that is a Select List from [Inv.].

In [Invoice], I have [INVS#], [Bill To] which relates to my CRM, and [Item] that is the table [InvoiceDetail].

In [InvoiceDetail], I have [INVS#] that is related to [Invoice].[INVS], and [Item] that is again a Select List from [Inv.].

So far, I have managed to create a row in [Invoice] with the formula: AddRow(Invoice,Invoice.[INVS#],thisRow.[ORD#])
And create rows in [InvoiceDetail] then copy the order# to invoice# using: OrderDetail.Filter(Order=thisRow).FormulaMap(AddRow(InvoiceDetail,InvoiceDetail.[INVS#], thisRow.[ORD#])).

But I am struggling to get it fill in the corresponding items in [InvoiceDetail]. Is there a way to do that?

Thank you in advance!

Can you please add what you have been able to do in a doc and share that? It is really difficult to understand your requirements.

So simply put, I want to create a Button column in [Order] which, upon click, will copy the corresponding rows from [OrderDetail] to [InventoryDetail]. Thank you!