>Well, I seem to have painted myself into a corner with this one. I have coded an application with 1 to Many parent/child relations going six deep. Each relationship is using internally generated key fields.
>
>Now, my client (internal) is asking for the capability to copy a relation tree from the top down to a new record - with it's own copy of all the children, grandkids, great grandkids, etc.
>
>No doubt this is a common situation - and I'd like to know how you folks handle this situation before I scratch a hole in my cranium right down to the medulla! I suspect I'm gonna have to work from the bottom to the top, using a temporary lookup table to map new ney fields to the old ones so I can keep the relationships straight....
>
>TIA for any advise.
What's exactly the problem? Your cod should meticulously go from top to bottom along the existing 'tree', generate new record IDs, keep them in cursors, and Insert records to tables, i.e. for each table you will have two 'scan': first one collect record ID to be copied to a cursor, second one goes through the cursor, generating new IDs, and at the same time Inserting new records into this table. Subsequently, the cursor will be used for the next step down the tree.
Edward Pikman
Independent Consultant