I wrote a non recursive tree sorting routine for
a help file system and the main problem I ran into
was what I was using to delimit the query assembled
to string was being entered as data and my
sorting routine saw this as delimiters...
I have compared this to our recursive tree sorter
and the recursive one was much slower by a factor of
two at least, and as the number of inputs became
greater the recursive method came close to expotential
growth in run time.
I could get my algorithm to run much quicker, and linearly
however, given time I would like to rewrite this
as a Java or C++ CFX since this would make it much faster.
I *still* use my sorting routine, I just have to make
sure no data is entered that will trip up the sort.
I am not sure how one could use queries to achieve
this effect.. but Dan if you know of a way mail me
off list as well... it would really help us out :)
Jeremy Allen
[EMAIL PROTECTED]
-----Original Message-----
From: Steve Nelson [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 30, 2000 11:23 AM
To: CF-Talk
Subject: Re: tree structure
for example:
folder
folder
data
folder
data
data
folder
folder
data
folder
folder
data
folder
data
data
If all the data is at the same level it's easy with his examples. When
there is data throughout the levels I felt his explanation fell short:
folder
data
folder
data
folder
data
folder
data
folder
data
folder
data
folder
folder
folder
folder
folder
data
folder
data
folder
folder
folder
folder
I've got a modified <cf_maketree> that does this, but it's slow. i want
to be able to do it in a single SQL statement. any ideas?
Steve
"Dan G. Switzer, II" wrote:
>
> Not quite sure exactly what you're asking. If you can provide an example,
I
> can probably answer it for you. I haven't run in to anything I haven't
been
> able to do.
>
> -Dan
>
> -----Original Message-----
> From: Steve Nelson [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 30, 2000 10:43 AM
> To: CF-Talk
> Subject: Re: tree structure
>
> The only thing i wasn't able to figure out from Joe's examples was doing
> N-deep trees.
>
> If you know how deep the trees are his examples work great, but if some
> of the items are on node 1 and others on nodes 2 or 3 or 4 etc, it
> didn't seem clear on how to get those.
>
> Do you know what i mean?
>
> Steve
>
> "Dan G. Switzer, II" wrote:
> >
> > There is a non-recursive tag way to do this. However, if at all
possible,
> > look to the db to handle this. There's a great book by Joe Celko called
> "SQL
> > for Smarties" that discusses a method called "Nested Tree Model" which
> will
> > allow you to pull out data in a tree format using any standard database.
> > This is much more efficient then having CF handle the tree creation for
> you.
> >
> > I can probably find the non-recursive tag I wrote. It basically uses a
> > string sort w/a structure but it's pretty efficient. Seemed to be much
> more
> > efficient then the recursive tag calling.
> >
> > -Dan
> >
> > -----Original Message-----
> > From: Pete Freitag [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, October 30, 2000 1:33 AM
> > To: CF-Talk
> > Subject: RE: tree structure
> >
> > Your going to need a recursive custom tag to do this. Here is a quick
> and
> > dirty way to do it...
> >
> > --page.cfm--
> > <cf_deletetree node="234">
> >
> > --deletetree.cfm--
> > <cfquery name="data">
> > SELECT catid from tbl
> > WHERE parent = #attributes.node#
> > </cfquery>
> > <cfif data.recordcount>
> > <!--- recursive call --->
> > <cf_deletetree node="#data.catid#">
> > </cfif>
> >
> > --
> > ______________________________________________
> > Pete Freitag ([EMAIL PROTECTED])
> > CFDEV.COM
> > ColdFusion Developer Resources
> > http://www.cfdev.com
> >
> > -----Original Message-----
> > From: Anuj Gakhar [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, October 30, 2000 1:02 AM
> > To: CF-Talk
> > Subject: tree structure
> >
> > I have got a databse table like this:
> >
> > catid category parent
> >
> > 1 auto 0
> > 2 autos1 1
> > 3 autos2 2
> > 4 autos3 3
> > 5 autos4 0
> > 6 autos5 0
> > 7 autos6 5
> >
> > and so on .....i can add and delete categories from the table from
another
> > template i have made...
> >
> > what i want is to make a tree structure of all the categories like this
> >
> > -->auto
> > -->autos1
> > -->autos2
> > -->autos3
> > -->autos4
> > -->autos5
> > -->autos6
> >
> > this tree structure should come dynamically and any no. of categories i
> add
> > should be displayed here.
> > i tried to do this but i got mixed up with cfloop and cfoutput and i
dont
> > have that much time to work on it....
> > can anybody please help me out of this.....
> > P.S There can be any no. of categories under another category ..so dont
> > think that there is only one subcategory under another category.
> >
> > I hope i get a solution for this here
> > thanks in advance...
> >
> > _________________________________________________________ Do You
Yahoo!?
> > Get your free @yahoo.com address at
> >
>
p://mail.yahoo.com ------------------------------------------------------
> > ------------------------------------------
> > Archives: http://www.mail-archive.com/[email protected]/
> > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or
send
> a
> > message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
> >
>
> --------------------------------------------------------------------------
> --
> > --------------------
> > Archives: http://www.mail-archive.com/[email protected]/
> > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or
send
> a
> > message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
> >
>
> --------------------------------------------------------------------------
> ----------------------
> > Archives: http://www.mail-archive.com/[email protected]/
> > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or
send
> a message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
> --------------------------------------------------------------------------
--
> --------------------
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send
a
> message with 'unsubscribe' in the body to
[EMAIL PROTECTED]
>
> --------------------------------------------------------------------------
----------------------
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send
a message with 'unsubscribe' in the body to
[EMAIL PROTECTED]
----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]