Copy parent record together with child records ; Action Only, No API, No workflow

I’m afraid I’m still not fully catching up with your own unique case but sounds like there is always a variable involved in your copy operation to determine where rows are finally associated.

What about firing one action first ? This action will create new form with column value in parent row where we pass the values of request fields from the selected parent? The hide those fields in the form and let the user to select out of Dropdown to decide where the destination is. Then save this form. Then upon saving the form it will fire the rest of actions , copy parent along with child’s. At this point of time we know destination. In your working case it looked like to me the user need to select the destination after copies are made. But my case, selection of destination is part of chain of actions.

1 Like

In my case, I open up a field in the originating parent record where I can select where to copy things. Then, as part of the action stack, I clear what was selected and reset the flag - to turn off the quick edits.

You could direct someone to a form where they select what to do, then take over the form even save action and enact your action stack there.

As always in AppSheet

Sure. Back to my original thread, i hope this trick will encourage the creativity of appsheet users.

3 Likes

Do you have a working example of this which you can share with us
I tried it it is not working now

Hi Tsuji, are you still using this method?

What if, you wanted to copy the Parent and its Children into an already created Grandparent record?

So basically, give the user the ability to create a new Grandparent record and during that creation process copy into that record a Parent record (and its Children)

I’ve got your actions working fine but I’m killing myself here trying to run this action from the Grandparent level so that the application can know what KeyId to use in the copy row action.

Do you have any ideas?

Where is the action initiated? On the parent record ? Hit action on parent record then create new grand parent to parent along with copying the child records? Is that what you want to achieve?

1 Like

Thanks for replying :slight_smile: I would like to initiate the action from the top level, my setup is:

Orders - Parent
Products - Child
Materials - Grandchild

I am trying to copy 1 Product record along with all owned Material records from (hopefully) somewhere on the Order record, as the action will (hopefully) then pass the OrderID into the row copy action and in-turn create the copy of the Product into the correct Order.

So the user process would be;

  • navigate to previously created order
  • open copy product form
  • select from enumlist of Product records to copy
  • run the action on form save

I could do it this way to, ie Hit action on Product record, however the user would need a drop down list of previously created Orders to select the Order they are wanting to copy the Product (and children) into, if that makes sense. I cant just copy a Product, I must give the user the ability to choose which Order in which to copy it into

Nothing is impossible with AppSheet, so I m pretty much sure your business requirement can be filled, most importly, with Aciton only. (no workflow, no automation)
However, it requires tons of jobs.

I m always building up AppSheet app in mind first (in my brain) then once we finised to build, then start to work manually.

Based on your requirement, this comes up with me.

First you create sort of intermediate table. You place this action to order table. This action will open the new form using linkeform expression. New form will capture 1) Source Order ID, 2) LIst of ids for source orders products as options for the enum list. Initially nothing is selected on this enumlist, or even all the producted selected by default (Either way upto your preference) . User will select the product throug the form.

Then save. On save action, fire those actions as a set.

  1. Create new order
  2. Using @steve s add new rows out of enumlist tips and tricks, add new rows based on the selected enumlist items (product) and push the foreing key to make a ref connection to this newly created order

Thats the most efficient ways, but still involved tons of hours to build up physical app (not virtual app in my mind)

1 Like

Great, thanks for that, i have setup a many to many table once already so i’ll have a look at that for a solution

This is the hard part isnt it, we always try to find the shortcut but often we then need to go back and set it up properly.

If i think through this feature from the users perspective it’s really two features

  1. copying an entire order with all related children
  2. copy specific products into an existing order

So i think i will modify your action group to run on 3 levels and then look at building out the second feature separately.

Thanks for engaging with me much appreciated :slight_smile:

Assuming we have
1.Parent
2.Child
3.Grand-Child

tables and records are linked toghther through ref column. I demonstarated to fire action to copy set of rows, triggering action from Parent record, but technically, we can fire the same from everwhere, from child or Grand-Child records, while the set ups are different though.

Good luck.

Hey there.

This is an extremely good Tip.

But I have a question, what happens if between the [Sub ID] Parent and the [Sub ID] Child we found a difference of time.

In my case I have:
[Parent ID]
ba28575c4ddc5d8e-735f-432f-945d-973af562b27506/17/2021 20:22:32
[Ref to Parent ID]
ba28575c4ddc5d8e-735f-432f-945d-973af562b27506/17/2021 20:22:33

What Can I do In this case ??

1 Like

I’ve had this issue also.

Hi, tsuji_koichi

You wrote:
“Create action to copy new row. For the ID of new parent record, make sure to pass [Sub ID] value rather than initial value expression uniqueid() to generate new ID.”

I choose the action: copy this row and edit the copy
I can’t find how to choose [SUB ID] for the ID of the new row

Sakis

初めまして、トゥエンと申します。このやり方を動画で説明して頂けませんでしょうか。
すみませんが、よろしくお願いします。