Need architectural advice on how to copy values from one row to another in same table

This one has me stumped so far, and the various approaches suggested by AI like Google all seem to be incomplete, that is, they don’t work. Plus I’m not an expert on actions.

Use case: table in Google sheet contains info on about 70 dog kennels in shelter (70 rows). Key is the kennel number. Attributes are dog name, time last walked, medical info, notes, etc. plus a handful of columns that are formulas (not editable in appsheet). When a dog is moved to another kennel we don’t want to have to manually reenter its attributes. A way to copy the editable attributes into the row for the new kennel is needed. The user selects the kennel number to which the data is to be copied, overwriting the values in that row. Ideally the selection would be by a pull-down listing all legal kennel numbers - that is, all the key values from the table. Also ideally the action would then delete (make blank) the attributes for the row copied from. My concept is to have user click on the row in the table view that contains the info on the dog that is being moved, see the detail form, see an action button “Move Dog”, click it then get a form or other input method to pick the destination kennel, save the form and data is moved.

I am now trying approaches with a helper table that could have one row to contain the key of the row from which to copy data and also the key of the row to which data is to be copied, then use some sort of grouped action to fetch these keys and do the copy, then erase the data from the old kennel’s row. There may be better architectural approaches.

Can anyone point to a thread or other source that describes recommended steps? I will continue experimenting, and will next try actions that: 1.delete all rows in the helper table, 2.use a linktoform to pass the key of the “from” row to the form, 3.let the user select a destination key in the form, 4.copy the specific columns values to the destination row 5.erase the copied columns from the source row.

If you setup a standard parent-child relationship between the “Dogs” table and “Moves” table, you can create a running history of the dog movements.

To get the “Last Movement” for a dog, you can do a clever trick using the [Related Moves] table (or whatever you call it)

  • index([Related Whatever], COUNT([Related Whatever]))
  • This pulls the last ID out of the list of related records
    • From this you can then dereference information out of it
    • Such as it’s location, status, date, etc.

In this way you can create multiple move records for a dog, and each dog will have it’s “current location” easily displayed.

Hope it helps!

3 Likes

An action to add a row in a table, using the same ID of the row you would like to be modified in your request, will override that row (will not add a new row).

I currently use this workaround for similar cases (overwrite a task instead of modifying it).

2 Likes