This topic is locked

Copy to also copy child records

5/7/2012 10:47:22 PM
ASPRunnerPro General questions
Q
Quintin author

When I use Copy to prepare to Add a new Parent record is it possible to also have any child records relating to the original copied to Add page in the Child Record Add section?
My guess is that when doing an Add Record the Parent and Child data is held in a temporary buffer until Save is pressed, at which point the Parent and Child data is added to the database. On a Copy the Child data is blank, waiting for input. Perhaps there is a way to load the Child data temporary buffer.
I'm using Copy as "By doing this you get at least 80% of the data you need for adding a new job but the details (Child) might be very different or might be the same".
Thanks.

Sergey Kornilov admin 5/8/2012

Copy feature doesn't actually copy the record. It rather prepolupates the Add page with the content of selected record. What you can do is to use AfterAdd event to copy details data of the record being copied.
What you need to do is to save the ID of the record being copied. Add the following code to 'Copy page: OnLoad' event:

Session("where") = where


Now Session("where") stores the WHERE clause that points to the source record i.e. ID=32 and you can use it in AfterAdd event to copy child data.

Q
Quintin author 5/8/2012



Copy feature doesn't actually copy the record. It rather prepolupates the Add page with the content of selected record. What you can do is to use AfterAdd event to copy details data of the record being copied.
What you need to do is to save the ID of the record being copied. Add the following code to 'Copy page: OnLoad' event:

Session("where") = where


Now Session("where") stores the WHERE clause that points to the source record i.e. ID=32 and you can use it in AfterAdd event to copy child data.


Thanks Sergey.
It moves me along a bit. Copying the Child records on an "After Add" is too late because I want the user to see both the Parent and Child Data before they do the Add. I will post a screen shot on my ticket.
Regards,
Stuart