Hi Chad,

Yes, recursion is certainly possible in CF5, I've used it on a number of occasions, even in 4.51.

I've generally used custom-tags but I'd guess you could also use UDFs and it can be quite simple...

In pseudo code...

In a custom tag file called getDataRecurs.cfm:

<cfquery name="myQuery" ...>
  select * from myTable
   where parentId = #attributes.parentId#
</cfquery>

<cfloop query="myQuery">
  ... Do something here *before* procesing children
  <cf_getDataRecurs parentId="#myQuery.itemId#">
  ... Do something here *after* procesing children
</cfloop>

In the code where you want to process the data you would simply use:

<cf_getDataRecurs parentId="0">

Assuming you have top level items with parentId's of 0, otherwise put in whatever ID you need to show just that part of the tree.

Let me know if you need a more comprehensive example.

Regards,

Brett
B)


Chad Renando wrote:
Hey all.  I am still old-chool CF5, should have access to CF7 this
week.  However, I have yet to get my head around cfscript, functions,
and CFCs.

I am wanting to do a recursive thing.  I have a table with FieldID,
FieldName, ParentFieldID.

I want to call all fields where ParentID = 0, then recursively call
all fields where ParentFieldID = FieldID, then start over at thge next
0 value ParentFieldID.

Currently, I am manually cflooping, no recursion.

Is this possible in CF5, and if so, how?

I wouldlike to know best practive with functions, but is it also
possible without functions?

Cheers,

Chad

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/


-- Brett Payne-Rhodes Eaglehawk Computing t: +61 (0)8 9371-0471 f: +61 (0)8 9371-0470 m: +61 (0)414 371 047 e: [EMAIL PROTECTED] w: www.ehc.net.au

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to