Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent / child sorting problem
Message
From
14/06/2010 08:56:38
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01468767
Message ID:
01468769
Views:
46
No I do not. Since I am interested in how to process this file in order, I am only concerned about its records.

However, if a solution required that in order to work, I could certainly add the records (the file does not yet exist, but will shortly)

>>I have an interesting sorting problem:
>>
>>I have a table with three fields: ParentID, ChildID, and SortKey
>>
>>ParentID and ChildID are both PKs from another table. Any of the PKs from that table may appear any number of times as a ParentID, and any number of times as a ChildID.
>>
>>What I'm looking for is a way to assign SORTKEY so that I can process this table in the order I want, which is this --
>>
>>I want all occurrences of any PK as a ChildID to precede any occurrences of that same PK as a ParentID. Stated another way -- I want to have all the first generation PKs at the top, followed by all second generations, etc. Thus, when sorted, I will know that each ParentID I encounter will not be referenced later as a childID.
>>
>>There is some possibility with circularity here, of course, and I'm hoping that any solution might help that this issue as well.
>>
>>Thanks in advance.
>
>Do you have NULL in ParentID for first generation (parents)? Also, do you want your result as a select statement or you somehow want it through the index?
Jim Nelson
Newbury Park, CA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform