Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying nested children to new codes
Message
 
To
08/10/1999 15:57:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00274449
Message ID:
00274469
Views:
27
>>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.

Well, I think the problem is that the replaced key field value occurs at two levels (parent and child) and if I change the parent first, I have lost all record of the children to it (because their key field is still the old one). What I need to do is, as you say, work from the top down - but select to cursor TWO levels at a time (parent and child) and then do some careful REPLACEing in BOTH cursors and then APPENDing back to the original tables, then step down to the next level to do the same thing.

Thanks for helping me to think it through.
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Previous
Reply
Map
View

Click here to load this message in the networking platform