Re: Building Hierarchal Lists using CF
Doug Boude has a fantastic tutorial on recursive functions here: http://www.dougboude.com/blog/1/2006/06/Recursive-Functions-in-ColdFusion.cfm Andrew. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331234 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Building Hierarchal Lists using CF
I would do this in a recursive function that takes a depth parameter that will indent the presented data in some form (margin,table cells,tabs) and return the formatted output. I have one that is kind of extensive that builds a hierarchal output of almost any value given to it, kinda like cfdump but it evaluates the objects. I can post it if you like. -Original Message- From: Steve Keator [mailto:skea...@mlinc.com] Sent: Friday, February 26, 2010 9:24 AM To: cf-talk Subject: Building Hierarchal Lists using CF Hello Gang, This one, I have to say, eludes me. There is probably a very easy way of doing this that I just don't see, but a little help would be awesome. I have a list of categories from a query where I have parent-child relationships going on, where my ID can also be associated within a column called 'PARENT'. Something like this: IDNameParent_ID 1 Category A 0 2 Category B 0 3 Category A1 1 4 Category A2 1 5 Category B12 6 Category B22 7 Category A3 1 .. and so on, to be displayed like this: Category A Category A1 Category A2 Category A3 Category B Category B1 Category B2 Anyways, I'm not quite sure how to handle this. Somehow I know a CFLOOP has to come into all of this (or several)? I'd like to be able to make this modular so that even 5 or 6 nests deep that every category in my query would show (without, of course, getting repetitive and redundant in coding). Any thoughts or hints? Cheers, S. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331175 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Building Hierarchal Lists using CF
Hello Gang, This one, I have to say, eludes me. There is probably a very easy way of doing this that I just don't see, but a little help would be awesome. I have a list of categories from a query where I have parent-child relationships going on, where my ID can also be associated within a column called 'PARENT'. Something like this: IDNameParent_ID 1 Category A 0 2 Category B 0 3 Category A1 1 4 Category A2 1 5 Category B12 6 Category B22 7 Category A3 1 .. and so on, to be displayed like this: Category A Category A1 Category A2 Category A3 Category B Category B1 Category B2 Anyways, I'm not quite sure how to handle this. Somehow I know a CFLOOP has to come into all of this (or several)? I'd like to be able to make this modular so that even 5 or 6 nests deep that every category in my query would show (without, of course, getting repetitive and redundant in coding). Any thoughts or hints? Cheers, S. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331170 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4