I found Doug Boude's blog post on Recursive Functions in CF. Great post and explanation of how it works. My head was hurting trying to do it myself, but his explanation was priceless.
http://www.dougboude.com/blog/1/2006/06/Recursive-Functions-in-ColdFusion.cfm > -----Original Message----- > From: Chad Gray [mailto:[email protected]] > Sent: Tuesday, March 03, 2009 8:05 PM > To: cf-talk > Subject: displaying a tree structure > > > I have data in a table like this: > > ID ParentID Name > 1 0 Top > 2 1 Level1 > 3 1 Level2 > 4 2 Child1 Of Level2 > 5 2 Child2 Of Level2 > 6 3 Child1 Of Level2 > > So the tree would look like this: > > Top > Level1 > Child1 Of Level1 > Child2 Of Level1 > Level2 > Child1 Of Level2 > > Hopefully the tabs in the email will format when I send this so it is easy > to read. > > How do I loop over this data to display the tree dynamically? I have used > Loops with queries to get each levels childs, but the way I wrote it I > have to have a loop for each level. What if I have unlimited childs? My > loops will only display as many childs as I have loops. > > Maybe there is a better way to structure the data in the first place. > > Thanks! > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320097 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

