I haven't tried the way you did it yet Kerry. I did get it to work however.
Claude, you're incorrect on the database structure of a tree. You can put it all in one table and recursively get the entire tree. How else could you support unlimited parent child relationships? I have trees that go 20 deep. I'm definitely not going to have a table for each child. Thanks for the help. Emmet -----Original Message----- From: Kerry [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 10:57 AM To: CF-Talk Subject: RE: get parent items from list? >What's the most efficient way of determining the parent of any item in the > list and determining that item1 has no parent perhaps im missing something here, but: mylist = "item1,item2,item3,item4"; for(i=1; i lte ListLen(mylist);i=i+1){ WriteOutput("I am: "&ListGetAt(mylist,i)); if(i eq 1){ WriteOutput(" and I am the root"); }else{ WriteOutput(" and my parent is: "&findparent(mylist,ListGetAt(mylist,i))); } WriteOutput("<br>"); } function findparent(nlist,me){ var myparent = "root"; var myindex = ListFind(nlist,me); if(myindex gt 1){ myparent = ListGetAt(nlist,myindex-1); } return myparent; } -----Original Message----- From: Jerry Barnes [mailto:[EMAIL PROTECTED] Sent: 02 June 2005 15:36 To: CF-Talk Subject: Re: get parent items from list? Sounds like an adjaceny list model. Does the list contain the whole tree or does a list only contain a path from one node to another while other lists contain other paths? On 6/2/05, Emmet McGovern <[EMAIL PROTECTED]> wrote: > > Brain Meltdown. Maybe someone can help. > > I have a list such as (item1,item2,item3,item4,item5). The list can be any > length. Item1 would be the parent of item2 and item2 would be the parent > of > item3 and so on. > > What's the most efficient way of determining the parent of any item in the > list and determining that item1 has no parent? > > Thanks, > Emmet > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208424 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

