Re: get parent items from list?
>>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. This is exactly what I said, how am I incorrect? I said "You need at least a table with one column for item and one for its parent." This is ONE table with TWO columns, the minimum it takes, with this you can describe a tree with unlimited branches to an unlimited number of levels. >>I'm definitely not going to have a table for each child. I hope so! ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208426 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
RE: get parent items from list?
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(""); } 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
Re: get parent items from list?
>>What I'm getting is a list of items in their tree hierarchy. This is just not possible with only a list. If you just have a list, in which every item is the next item parent, then your tree has only one branch. You need at least a table with one column for item and one for its parent. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208385 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
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(""); } 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:208383 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
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 > > > > ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208373 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
RE: get parent items from list?
But where is this list coming from? With a parent ID you can't do it. -Original Message- From: Emmet McGovern [mailto:[EMAIL PROTECTED] Sent: Friday, 3 June 2005 12:30 AM To: CF-Talk Subject: RE: get parent items from list? What I'm getting is a list of items in their tree hierarchy. I just need to insert them in a database with their parent child relationships intact. -Original Message- From: Andrew Scott [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 10:21 AM To: CF-Talk Subject: RE: get parent items from list? Without more information this request is not possible. Is this coming from a database then use the original query to build a parent child relationship, without and identifier which indicates what the parent is then you can do what your asking. -Original Message- From: Emmet McGovern [mailto:[EMAIL PROTECTED] Sent: Friday, 3 June 2005 12:09 AM To: CF-Talk Subject: get parent items from list? 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 ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208371 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
Re: get parent items from list?
thats what i was trying to say, thanks andrew. emmet... do this... simply add a parentID column to your table, and whatever value that is, you can find its parent, or no parent. tw On 6/2/05, Andrew Scott <[EMAIL PROTECTED]> wrote: > Without more information this request is not possible. > > Is this coming from a database then use the original query to build a parent > child relationship, without and identifier which indicates what the parent > is then you can do what your asking. > > > -Original Message- > From: Emmet McGovern [mailto:[EMAIL PROTECTED] > Sent: Friday, 3 June 2005 12:09 AM > To: CF-Talk > Subject: get parent items from list? > > 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 > > > > > > ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208370 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: get parent items from list?
What I'm getting is a list of items in their tree hierarchy. I just need to insert them in a database with their parent child relationships intact. -Original Message- From: Andrew Scott [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 10:21 AM To: CF-Talk Subject: RE: get parent items from list? Without more information this request is not possible. Is this coming from a database then use the original query to build a parent child relationship, without and identifier which indicates what the parent is then you can do what your asking. -Original Message- From: Emmet McGovern [mailto:[EMAIL PROTECTED] Sent: Friday, 3 June 2005 12:09 AM To: CF-Talk Subject: get parent items from list? 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 ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208368 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: get parent items from list?
Without more information this request is not possible. Is this coming from a database then use the original query to build a parent child relationship, without and identifier which indicates what the parent is then you can do what your asking. -Original Message- From: Emmet McGovern [mailto:[EMAIL PROTECTED] Sent: Friday, 3 June 2005 12:09 AM To: CF-Talk Subject: get parent items from list? 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 ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208366 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
Re: get parent items from list?
is this coming out of a database? or simply a list? im not sure with a list, with no other properties, that you can make an intelligent choice which is a parent of which... tw 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 > > > > ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208361 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: get parent items from list?
To clarify. The reason I'm asking is that I need to loop and insert all items in a table to create a tree. So it would have to start with the first item in the list to get an ID for the second item. >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 ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208360 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54