Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to develop db schema for sales reporting system
Message
From
18/05/2006 13:04:31
 
 
To
18/05/2006 12:46:09
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01122777
Message ID:
01123300
Views:
20
Dragan,

Thanks!! This is exactly what I am looking for! It will take me a while to digest this thread! I had done a search on 'parent-child-grandchild, 'tree', etc. but what I found was not quite relevant, somehow I missed this thread.

I think that for now, to get the application done and out the door, which needs to be done very soon (2 weeks ago), parent-child will do. But in the near future I will need to support multiple levels of nesting.

I'll try to answer your questions after I read the thread and study it for a while.

>>Dragan,
>>
>>Yes. That's what I am doing, assembling the pieces of the query on demand by looping through the query conditions detail table.
>>
>>I have made some good progress, but not come up with a 'complete solution' for processing parent and child records. The code I wrote so far handles parent and child, but not an 'infinite number of descendants and descendant levels', which is what I think I want. I don't have any sample code for this, but I think that what I want is the type of code that would handle an exploded Bill of Materials with nesting of assembly parts and sub assemblies.
>>
>>If you have any suggestions on algorithms, data structure that would be great.
>
>I'd recommend thread #600157, this type of recursion was discussed at length then.
>
>Looking at your code, are you saying that child conditions may be split into deeper conditions, or was the recursion thing related to just BOMs?
>
>If it's just the BOMs, then (in meta-code)
>
>
create cursor crsFinal
>*-- get the items which go in directly
>insert into crsFinal ;
>select <fieldlist here> where itemno not in (select parentitemno from assembly)
>
>*-- now get the ones which are assemblies
>select <fieldlist here> where itemno in (select parentitemno from assembly);
>   into cursor tmp
>insert into crsfinal;
>   select * from tmp where itemno not in (select parentitemno from assembly)
>*-- now somehow repeat the last two steps as long as there were any records to insert.
>
>This is the case where you have an assembly table as discussed in the thread I mentioned. If your assembly is self-referencing, then it'd look a bit different. The last time I had to deal with multi-level assembly lists was more than seven years ago, so forgive me if I'm a bit rusty here.
Previous
Reply
Map
View

Click here to load this message in the networking platform