Hi
Thanks! Yep. This is effectively what I'm doing with the cursors.
Was trying to work out if I can do this another way due to the speed of the
thing.

Regards

Graham



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Ed Leafe
Sent: 19 April 2007 17:33
To: ProFox Email List
Subject: Re: Self referencing joins


On Apr 19, 2007, at 12:30 PM, Graham Brown ((CompSYS)) wrote:

> With the application I can easily go 15 levels deep due to the way my
> customer sets up how they build things
>
> What I need to do is get this info into a cursor so I can populate a
> treeview with it, I currently create cursor_level1 for the children
> in J1
> and then create another cursor for J4 then another cursor for J12
> which is
> dog slow. I have complication that in my example above if the
> customer needs
> two computers then all qtys underneath must be multiplied by 2.
> However if
> it is one computer with 2 monitors then I'll need 2 monitor cases
> and 8
> buttons. This quantity ripples all the way down 15 levels or
> however many.
>
> Could anyone assist with an SQL statement to show the hierachy in a
> cursor.

        I don't believe you can accomplish this in a single SQL statement.
Probably the best approach is to use CREATE CURSOR to create the
structure you want, and then run a query, appending the results to
the cursor. Then iterate through all the records of the results,
using the keys in those records to get all the sub-assemblies, which
are then added to the main cursor, and then these records are queried
for their child records.

        Obviously something like this lends itself to recursive calls, as
long as you know that your data is sound (i.e., that it doesn't
contain an assembly that contains parts that contain the original
assembly).

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to