Copy related rows in case "Repeat last order"

Hi! In my case customers make orders. My data sheet contain two sheets: “Orders” and “Order positions”.
“Order” sheet fields:

  • Row ID
  • Order num
  • Order date
  • ID User

“Order positions” sheet field:

  • Row ID
  • ID Order (Row ID from “Order” sheet)
  • Product name
  • Count of product
  • State (one of values: “new”, “in process”, “executed”)

In application, customer select order and pressing on button “Repeate order”. Application must copy selected order as new:

  1. Insert new row into sheet “Order”, get Row ID
  2. Copy all position form sheet “Order positions”, where [ID Order] = [Row ID of source order]
  3. Paste copied positions into sheet “Order positions”, replaced [ID order] on [Row ID of new order] and in [State] set value “new”.

Help me, please, realize this scenario.

This should be fairly straight forward.

I’ll assume that you present past orders as an inline list, and selecting one does a standard show details screen action. Then all you need to do is add a button to that screen “Repeat this Order”, and the action attached to that button can do an Add Row to your orders sheet, using the values from the current row (and maybe just changing the date).

1 Like

Yes, copy order row - is simple task. But i don’t know, how copy multiple rows with order products form “Order positions” sheets.