Re: Recursion to retrieve blog thread - help please

2008-11-05 Thread Christophe Maso
Thank you very much - this works beautifully! 

~|
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:314889
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion to retrieve blog thread - help please

2008-11-05 Thread Jason Fisher
Original call would look something like this, where entryID is all you need to 
start with:



This would create a query result called myReplyTreeQry with the following 
columns:
entryID
replyID (of each reply)
parentReplyID (of each reply, not really needed, but good for debugging)
level (of each reply, to help in indenting as you output them)

Obviously, more columns would need to be added to show all the actual Reply 
information, but this works for the recursive structure.




















AND r.parentReplyID = 



















~|
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:314872
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion Output Help

2008-07-24 Thread Gerald Guido
I have a simple recursion example that I used a menu-ing system few years
back. Perhaps it may help.

http://mgt.pastebin.com/f4ff2f94f

On Thu, Jul 24, 2008 at 2:39 PM, Mark Leder <[EMAIL PROTECTED]> wrote:

> I did.  Couldn't figure out that logic + tree breaks when I only want to
> return nodes and levels that correspond with documents/db listings on the
> server.
>
> -Original Message-
> From: Gerald Guido [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 24, 2008 2:09 PM
> To: CF-Talk
> Subject: Re: Recursion Output Help
>
> Did you look at this:
> http://nstree.riaforge.org/
>
> On Thu, Jul 24, 2008 at 1:36 PM, Mark Leder <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
> >
> >
> >
> > Been working on a recursion output for several days now without success.
> > Using a single category table with "ID, Name, ParentID".  The nesting is
> up
> > to four layers deep.  Problem is, I want to tie the results set to
> > documents
> > that have been posted, with the categoryID referencing the documentID.
> And
> > only showing those collapsable tree elements that have documents (without
> > breaking the tree).
> >
> >
> >
> > If anyone is open to assisting with display output, for fee, I'd greatly
> > appreciate it.  I don't care about what format the display takes (flash,
> > html, jquery, extjs, etc.) as long as it loads reasonably quickly.  Need
> to
> > do this pretty quickly, by mid-next week.   Can show you all the params
> via
> > webex.  Using CF8 and MS-SQL 2000.
> >
> >
> >
> > Contact me off list if your interested.  EDT Time zone.
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Mark
> >
> >
> >
> >
> >
>
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309674
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Recursion Output Help

2008-07-24 Thread Mark Leder
I did.  Couldn't figure out that logic + tree breaks when I only want to
return nodes and levels that correspond with documents/db listings on the
server.

-Original Message-
From: Gerald Guido [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 24, 2008 2:09 PM
To: CF-Talk
Subject: Re: Recursion Output Help

Did you look at this:
http://nstree.riaforge.org/

On Thu, Jul 24, 2008 at 1:36 PM, Mark Leder <[EMAIL PROTECTED]> wrote:

> Hi All,
>
>
>
> Been working on a recursion output for several days now without success.
> Using a single category table with "ID, Name, ParentID".  The nesting is
up
> to four layers deep.  Problem is, I want to tie the results set to
> documents
> that have been posted, with the categoryID referencing the documentID.
And
> only showing those collapsable tree elements that have documents (without
> breaking the tree).
>
>
>
> If anyone is open to assisting with display output, for fee, I'd greatly
> appreciate it.  I don't care about what format the display takes (flash,
> html, jquery, extjs, etc.) as long as it loads reasonably quickly.  Need
to
> do this pretty quickly, by mid-next week.   Can show you all the params
via
> webex.  Using CF8 and MS-SQL 2000.
>
>
>
> Contact me off list if your interested.  EDT Time zone.
>
>
>
> Thanks,
>
>
>
> Mark
>
>
>
>
> 



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309658
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion Output Help

2008-07-24 Thread Gerald Guido
Did you look at this:
http://nstree.riaforge.org/

On Thu, Jul 24, 2008 at 1:36 PM, Mark Leder <[EMAIL PROTECTED]> wrote:

> Hi All,
>
>
>
> Been working on a recursion output for several days now without success.
> Using a single category table with "ID, Name, ParentID".  The nesting is up
> to four layers deep.  Problem is, I want to tie the results set to
> documents
> that have been posted, with the categoryID referencing the documentID.  And
> only showing those collapsable tree elements that have documents (without
> breaking the tree).
>
>
>
> If anyone is open to assisting with display output, for fee, I'd greatly
> appreciate it.  I don't care about what format the display takes (flash,
> html, jquery, extjs, etc.) as long as it loads reasonably quickly.  Need to
> do this pretty quickly, by mid-next week.   Can show you all the params via
> webex.  Using CF8 and MS-SQL 2000.
>
>
>
> Contact me off list if your interested.  EDT Time zone.
>
>
>
> Thanks,
>
>
>
> Mark
>
>
>
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309642
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Recursion problem

2007-09-21 Thread Mike Little
this is a wondeful tutorial matt! thanks heaps for the link.

a lot is a little over my head, but i am getting there!!

mike

>http://tutorial478.easycfm.com/ 

~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289172
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion problem

2007-09-21 Thread Claude Schneegans
 >>run it and find out.  It is not a memory issue.

Of course it is not.
Recursing to a level of 1000 is not a problem.

As I said, with a factorial function, you will hit an overflow before 
any limit of recursion or any memory limit.
Can ou imagine how large is 1000! ?

At a certain point, you hit an infinite value, and this brakes the 
returntype="numeric" condition.
This is what caused the error.

The limit is the size of a numeric value that CF can handle, nothing to 
do with a limit with recursive functions.

-- 
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289107
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Recursion problem

2007-09-21 Thread Wil Genovese
run it and find out.  It is not a memory issue.


-- 
Wil Genovese

One man with courage makes a majority.
-Andrew Jackson

A fine is a tax for doing wrong. A tax is a fine for doing well. 



Claude Schneegans wrote:
>  >>This little factorial function will show you that limit in a hurry
>
> IMO, with a factorial function, you will hit a numeric overflow far 
> before any limit in recursion level.
>
> I have some recursive functions, got them loop to infinity while 
> debugging, and like in most languages,
> the only limit I got with CF was memory.
>
>   

~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289092
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Recursion problem

2007-09-21 Thread Claude Schneegans
 >>The recordset is not returning the heirarchy correctly however.

Please define "not correctly"

-- 
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289087
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Recursion problem

2007-09-21 Thread Claude Schneegans
 >>This little factorial function will show you that limit in a hurry

IMO, with a factorial function, you will hit a numeric overflow far 
before any limit in recursion level.

I have some recursive functions, got them loop to infinity while 
debugging, and like in most languages,
the only limit I got with CF was memory.

-- 
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.


~|
ColdFusion is delivering applications solutions at at top companies 
around the world in government.  Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289086
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion problem

2007-09-20 Thread Matt Quackenbush
http://tutorial478.easycfm.com/


~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289067
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion problem

2007-09-20 Thread James Holmes
You can get the whole structure on one query:

http://www.oreilly.com/catalog/sqlpr/chapter/ch01.pdf

On 9/21/07, Mike Little <[EMAIL PROTECTED]> wrote:
> i will only ever be going 2-3 levels deep at this stage.
>
> >I'm not sure how many levels of recursion your trying to do, but with CF
> >there is a limit to recursion.  This little factorial function will show
> >you that limit in a hurry if you put in a large enough value.
> >
> > >output="yes">
> >
> >
> >
> >
> >Calling myself with #arguments.end_value-1#
> >
> >
> >
> >
> >
> >#factorial(1000)#
> >
> >
> >Wil Genovese
> >
> >One man with courage makes a majority.
> >-Andrew Jackson
> >
> >A fine is a tax for doing wrong. A tax is a fine for doing well.
> >
> >
> >
> >Mike | NZSolutions Ltd wrote:
> >>
>
> 

~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289066
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Recursion problem

2007-09-20 Thread Mike Little
i will only ever be going 2-3 levels deep at this stage.

>I'm not sure how many levels of recursion your trying to do, but with CF 
>there is a limit to recursion.  This little factorial function will show 
>you that limit in a hurry if you put in a large enough value.
>
>output="yes">
>
>
>
>
>Calling myself with #arguments.end_value-1#
>
>
>
>
>
>#factorial(1000)#
>
>
>Wil Genovese
>
>One man with courage makes a majority.
>-Andrew Jackson
>
>A fine is a tax for doing wrong. A tax is a fine for doing well. 
>
>
>
>Mike | NZSolutions Ltd wrote:
>> 

~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289065
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Recursion problem

2007-09-20 Thread Wil Genovese
I'm not sure how many levels of recursion your trying to do, but with CF 
there is a limit to recursion.  This little factorial function will show 
you that limit in a hurry if you put in a large enough value.






Calling myself with #arguments.end_value-1#





#factorial(1000)#


Wil Genovese

One man with courage makes a majority.
-Andrew Jackson

A fine is a tax for doing wrong. A tax is a fine for doing well. 



Mike | NZSolutions Ltd wrote:
> Hi guys,
>
> I am attempting to create a limitless level category system.
>
> This is what I have so far...
>
> Calling page...
>
> 
> #application.category.display_categories(0)#
> 
>
> Cfc...
>
>  returntype="query">
>   
>   
>   
>username="#variables.dbusername#" password="#variables.dbpassword#">
>   SELECT *
>   FROM categories
>   WHERE 1=1
>   
>   AND cat_id =  cfsqltype="cf_sql_integer" value="#arguments.cat_id#">
>   
>   
>   AND parent_id =  cfsqltype="cf_sql_integer" value="#arguments.parent_id#">
>   
>   
>   
>   
>   
>
> 
>   
>   
>   
>   
> 
> 
>   
>get_categories(parent_id=arguments.parent_id)>
>   
>   
>"
>cellspacing='0' cellpadding='5'>
>   
>   #getCategories.cat_title#
>href='index.cfm?action=product_manager&page=editCat&cat_id=#getCategories.ca
> t_id#'>Edit
>   
>href='index.cfm?action=product_manager&page=categories&step=delete&cat_id=#g
> etCategories.cat_id#' onClick='GP_popupConfirmMsg('Are you sure you wish to
> delete the category #getCategories.cat_title#? This action cannot be
> undone.');return document.MM_returnValue'>Delete
>   
>   
>   
>   #arguments.level# ID:#getCategories.cat_id#
>   ">
>   
>variables.output &
> display_categories(parent_id=getCategories.cat_id,level=arguments.level +
> 1)>
>   
>   
>   
>   
>   
>
> The recordset is not returning the heirarchy correctly however. Can anyone
> see what (big) mistakes I am making??
>
> Thanks heaps.
> mike
>
>
>
> 

~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289063
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Recursion anyone?

2005-10-27 Thread Stephen Whiteley
Thanks David, I get that:)

Steve

~|
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:222402
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: Recursion anyone?

2005-10-26 Thread David Livingston
An easy way to do recursion in cf is to use a custom tag. One of the  
things you will have to do is have your top level be set to a parent  
id that wont get used in any levels below it. I like to set the top  
level to zero or one.
The first time you call your custom tag you just pass the top level  
id you have chosen in as the first id. Then inside of that call the  
tag again passing the parentid. The code is untested but should give  
you a general idea.

Dave




The code would go something like this:




 SELECT ID, CategoryName, ParentItemID
 FROM CategoryTable
 WHERE ParentItemID = #Attributes.ParentItemID#



-#CategoryName#








On Oct 26, 2005, at 5:15 AM, Stephen Whiteley wrote:

> Hi
>
> I keep returning to this problem in order to build an infinite  
> DHTML menu (a task which has now become a quest and a matter of  
> honour). Does anyone know how to recurse through an adjacency list  
> model table, of the following setup
>
> ID CategoryName ParentItemID
>
> Also, I hear you can use CFTREE format="xml" or format="object" and  
> then use that to make a DHTML menu? anyone have any experience
>
> Muchos Thank You's
>
> Steve
>
> 

~|
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:222390
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: Recursion anyone?

2005-10-26 Thread Stephen Whiteley
Hi

Thanks everyone, there's lots of different approaches here which I'll look at 
over time. Brain got tired in the end! I just thought that with the new CFTREE 
format options i.e. xml and object, that there could be a quick (and easy) way 
to do DHTML menus.

But I've learnt quite a bit, sorry if I hacked anyone off - the ease of basic 
Coldfusion means that not everyone who uses it is a full-on programmer with a 
computer-science degree. So difficult to debug code when you're not 100% sure 
what it does!

I eventually found an off the peg DHTML and recursion solution here 
http://www.xtreeme.com/dhtml/dynamic-creation/ which although not directly 
supporting coldfusion does work really well and solves my immediate problem.

Thanks again

Steve

~|
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:222369
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: Recursion anyone?

2005-10-26 Thread Emmet McGovern
You're correct.  It simply reincludes itself till it no longer finds a
dependency.  I know there are more efficient ways to do it but it works for
this example.

This discussion forces me to revisit.  One day I'll purty it up a bit more
and put it up for download somewhere.  Haven't looked at it for some time.

Emmet



-Original Message-
From: Kerry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 26, 2005 12:23 PM
To: CF-Talk
Subject: RE: Recursion anyone?

make that 1 query for every parent, + 1 query for each child of each parent.

-Original Message-
From: Emmet McGovern [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:49
To: CF-Talk
Subject: RE: Recursion anyone?


Here's a use of treeview.nets treeview with recursion.
http://fullcitymedia.com/apps/treeview

You can download the code here.
http://fullcitymedia.com/apps/treeview/treeview.zip

Take a look, might be similar to what you're looking for.

Emmet

-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 10:30 AM
To: CF-Talk
Subject: Re: Recursion anyone?

Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.
The start tag must have a matching end tag. An explicit end tag can be
provided by adding . If the body of the tag is empty you can use
the shortcut .


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve







~|
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:222361
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: Recursion anyone?

2005-10-26 Thread Kerry
make that 1 query for every parent, + 1 query for each child of each parent.

-Original Message-
From: Emmet McGovern [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:49
To: CF-Talk
Subject: RE: Recursion anyone?


Here's a use of treeview.nets treeview with recursion.
http://fullcitymedia.com/apps/treeview

You can download the code here.
http://fullcitymedia.com/apps/treeview/treeview.zip

Take a look, might be similar to what you're looking for.

Emmet

-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 10:30 AM
To: CF-Talk
Subject: Re: Recursion anyone?

Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.
The start tag must have a matching end tag. An explicit end tag can be
provided by adding . If the body of the tag is empty you can use
the shortcut .


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve





~|
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:222357
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: Recursion anyone?

2005-10-26 Thread Kerry
Just had a read of the code, it does 2 queries for every parent in the
database?
Did I read that correctly?

-Original Message-
From: Emmet McGovern [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:49
To: CF-Talk
Subject: RE: Recursion anyone?


Here's a use of treeview.nets treeview with recursion.
http://fullcitymedia.com/apps/treeview

You can download the code here.
http://fullcitymedia.com/apps/treeview/treeview.zip

Take a look, might be similar to what you're looking for.

Emmet

-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 10:30 AM
To: CF-Talk
Subject: Re: Recursion anyone?

Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.
The start tag must have a matching end tag. An explicit end tag can be
provided by adding . If the body of the tag is empty you can use
the shortcut .


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve





~|
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:222355
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: Recursion anyone?

2005-10-26 Thread Thomas Chiverton
On Wednesday 26 October 2005 16:03, Kerry wrote:
> dude, I dont mind helping with the overall "how do i do this", but asking
> me to debug simple errors in your code is pushing it.

This is why most of the time I will only post pseudo-code, unless there is 
some important point the code needs to get across.

I'm all for offering 'how to' and the odd bit of skeleton code, but I don't 
develop ColdFusion code for free :-)
Although, OTOH the list does need to cater for all ability types, and 
sometimes that does mean a fully worked up example, I suppose.

-- 

Tom Chiverton 
Advanced ColdFusion Programmer

~|
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:222351
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: Recursion anyone?

2005-10-26 Thread Kerry
buildmenu(10,0);


-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:30
To: CF-Talk
Subject: Re: Recursion anyone?


Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.
The start tag must have a matching end tag. An explicit end tag can be
provided by adding . If the body of the tag is empty you can use
the shortcut .


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve



~|
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:222342
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: Recursion anyone?

2005-10-26 Thread Kerry
>11 :   for(i=1; i lte parentitemid.menuqry.recordcount; i=i+1){

My original post contains:
variables.inst.menuqry.recordcount

You changed it to:
parentitemid.menuqry.recordcount

Change it back.

p.s.
dude, I dont mind helping with the overall "how do i do this", but asking me
to debug simple errors in your code is pushing it.


-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 15:52
To: CF-Talk
Subject: Re: Recursion anyone?


Thanks, missed that

Still throwing an error though

Variable PARENTITEMID is undefined.


The error occurred in
C:\Inetpub\wwwroot\bigtripper\recurse\testfunction.cfm: line 11

9 : function buildmenu(currentid,depth){
10 :   var i=0;
11 :   for(i=1; i lte parentitemid.menuqry.recordcount; i=i+1){
12 :   if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)


The code is below:


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recordcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(1,0);


Thanks

Steve



~|
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:222329
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: Recursion anyone?

2005-10-26 Thread Stephen Whiteley
Thanks, missed that

Still throwing an error though

Variable PARENTITEMID is undefined.  
 
  
The error occurred in C:\Inetpub\wwwroot\bigtripper\recurse\testfunction.cfm: 
line 11
 
9 : function buildmenu(currentid,depth){
10 :   var i=0;
11 :   for(i=1; i lte parentitemid.menuqry.recordcount; i=i+1){
12 :   if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)

 
The code is below:


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recordcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryname[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(1,0);


Thanks

Steve

~|
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:222324
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: Recursion anyone?

2005-10-26 Thread Emmet McGovern
Here's a use of treeview.nets treeview with recursion.
http://fullcitymedia.com/apps/treeview 

You can download the code here.
http://fullcitymedia.com/apps/treeview/treeview.zip 

Take a look, might be similar to what you're looking for.

Emmet

-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 26, 2005 10:30 AM
To: CF-Talk
Subject: Re: Recursion anyone?

Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.  
The start tag must have a matching end tag. An explicit end tag can be
provided by adding . If the body of the tag is empty you can use
the shortcut . 


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve



~|
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:222323
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: Recursion anyone?

2005-10-26 Thread Andy Matthews
You're missing a semicolon at the end of the last expression in the cfscript
tag. This:
buildmenu(10,0)

should be this:
buildmenu(10,0);



-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 9:30 AM
To: CF-Talk
Subject: Re: Recursion anyone?


Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following
error.

Context validation error for tag cfscript.
The start tag must have a matching end tag. An explicit end tag can be
provided by adding . If the body of the tag is empty you can use
the shortcut .


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve



~|
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:222310
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: Recursion anyone?

2005-10-26 Thread Stephen Whiteley
Thanks Kerry

I'm starting to understand, got no experience of cfscript but it seems a lot 
like actionscript.

Unfortunately I've tried to run the code and I'm getting the following error.

Context validation error for tag cfscript.  
The start tag must have a matching end tag. An explicit end tag can be provided 
by adding . If the body of the tag is empty you can use the shortcut 
. 


This is the exact code


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes




variables.inst.menuqry = getAllCategories;

function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryname[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)


Steve

~|
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:222308
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: Recursion anyone?

2005-10-26 Thread Kerry
1) in my original code, getallcategories is a function, not a query.
change to: variables.inst.menuqry = getAllCategories;

2) note that the buildmenu function does not return anything, so this:


Is going to give you null.


3) writeoutput(variables.menuqry.adcategoryname);

This is just going to give you one big indecipherable string.


function buildmenu(currentid,depth){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryna
me[i]&"");
buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1);
  }
  }

buildmenu(10,0)




3.2) variables.menuqry.adcategoryname
This will always give you the first record's categoryname.
when doing a for() loop, you _must_ use the counter
variables.menuqry.adcategoryname[i]


Good luck!



-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 14:51
To: CF-Talk
Subject: Re: Recursion anyone?


Kerry

I'm trying to get you code to work but will be making a real hash of it, I
wonder if you take a look at this, I think getting the query in is the
problem.


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes





variables.inst.menuqry = getAllCategories();

function buildmenu(currentid){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(variables.menuqry.adcategoryname);
buildmenu(variables.inst.menuqry.itemid[i]);
  }
  }






#returnvalue#

thanks


Steve



~|
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:222302
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: Recursion anyone?

2005-10-26 Thread Stephen Whiteley
Kerry

I'm trying to get you code to work but will be making a real hash of it, I 
wonder if you take a look at this, I think getting the query in is the problem.


SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes





variables.inst.menuqry = getAllCategories();

function buildmenu(currentid){
  var i=0;
  for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){
  if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID)
writeoutput(variables.menuqry.adcategoryname);
buildmenu(variables.inst.menuqry.itemid[i]);
  }
  }






#returnvalue#

thanks


Steve

~|
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:95
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: Recursion anyone?

2005-10-26 Thread Andy Matthews
Stephen...

Here's some code for you. Create the table first:

CREATE TABLE links (
link_id smallint(5) unsigned NOT NULL auto_increment,
link_childof smallint(5) unsigned NOT NULL default '0',
link_name varchar(100) NOT NULL default '',
) TYPE=MyISAM;

Then here's the SQL to pull 3 levels of links.


SELECT
top.link_id AS top_id, top.link_name AS top_name,
mid.link_id AS mid_id, mid.link_name AS mid_name,
sub.link_id AS sub_id, sub.link_name AS sub_name
FROM links top
LEFT OUTER JOIN links mid
ON mid.link_childof = top.link_id
LEFT OUTER JOIN links sub
ON sub.link_childof = mid.link_id
WHERE top.link_childof = 0
GROUP BY top_name, mid_name, sub_name
ORDER BY top_name, mid_name, sub_name


I use this method all the time and it works beautifully.



-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 6:11 AM
To: CF-Talk
Subject: Re: Recursion anyone?


Hi

Yes the problem is the recursion can't get my head round it, never used
CFSCRIPT before being a bit of a newbie.

Not trying to build a DHTML menu from scratch and would use an off the shelf
one.

CFTREE in CFMX 7 will output xml or a structure depending on format="" used.

I'll keep playing with the code provided thanks, but if anyone can expand
for a dummy, much appreciated

Steve



~|
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:94
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: Recursion anyone?

2005-10-26 Thread Stephen Whiteley
OK, this is my database setup

ItemID,ParentItemID,AdCategoryName

What I want to be able to do is output something like this (before I go to the 
DHTML menu stage, walk before I can run)

Accommodation
>Self Catering
>>Farmhouse
>>>Rustic Farmhouse
Activities
>Walking
>>Walking Routes
>> Walking Shops

etc. etc...

I'm sure once a get the hang of it I'll be ok but any help much appreciated

Thanks

Steve


~|
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:89
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: Recursion anyone?

2005-10-26 Thread Stephen Whiteley
Hi

Yes the problem is the recursion can't get my head round it, never used 
CFSCRIPT before being a bit of a newbie.

Not trying to build a DHTML menu from scratch and would use an off the shelf 
one.

CFTREE in CFMX 7 will output xml or a structure depending on format="" used.

I'll keep playing with the code provided thanks, but if anyone can expand for a 
dummy, much appreciated

Steve

~|
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:87
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: Recursion anyone?

2005-10-26 Thread Snake
Why not use one of the nice DHTML menus that already exists.

I have built a tag that creates an DHTML explorer tree, and all I do is
query my category's, putitng them in the correct order, then recursively
loop over that query to check for child items of the current node.

--
Russ

-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED] 
Sent: 26 October 2005 11:15
To: CF-Talk
Subject: Recursion anyone?

Hi

I keep returning to this problem in order to build an infinite DHTML menu (a
task which has now become a quest and a matter of honour). Does anyone know
how to recurse through an adjacency list model table, of the following setup

ID CategoryName ParentItemID

Also, I hear you can use CFTREE format="xml" or format="object" and then use
that to make a DHTML menu? anyone have any experience

Muchos Thank You's

Steve



~|
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:86
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: Recursion anyone?

2005-10-26 Thread James Holmes
Depending on your DB you may be able to do the recursion there rather
than in the CF or JS code:

http://www.oreilly.com/catalog/sqlpr/chapter/ch01.pdf

On 10/26/05, Stephen Whiteley <[EMAIL PROTECTED]> wrote:
> Hi
>
> I keep returning to this problem in order to build an infinite DHTML menu (a 
> task which has now become a quest and a matter of honour). Does anyone know 
> how to recurse through an adjacency list model table, of the following setup
>
> ID CategoryName ParentItemID
>
> Also, I hear you can use CFTREE format="xml" or format="object" and then use 
> that to make a DHTML menu? anyone have any experience

~|
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:85
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: Recursion anyone?

2005-10-26 Thread Kerry
There are loads and loads of DHTML menus out there, e.g.
http://www.dynamicdrive.com/dynamicindex1/hvmenu/

with the actual menu code taken care of, all you have to do is recurse over
your database and write out the menu items.

last time i checked, cftree outputs a java applet, not javascript.

do you not know how to recurse?

heres some pseudo code

variables.inst.menuqry = getAllCategories();

function buildmenu(currentid){
var i=0;
for(i=1; i lte variables.inst.menuqry.recorcount; i=i+1){
if(variables.inst.menuqry.parent_id[i] eq arguments.currentID)
writeoutput(your javascript);
buildmenu(variables.inst.menuqry.id[i]);
}
}
}

buildmenu(yourrootid);


-Original Message-
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: 26 October 2005 11:15
To: CF-Talk
Subject: Recursion anyone?


Hi

I keep returning to this problem in order to build an infinite DHTML menu (a
task which has now become a quest and a matter of honour). Does anyone know
how to recurse through an adjacency list model table, of the following setup

ID CategoryName ParentItemID

Also, I hear you can use CFTREE format="xml" or format="object" and then use
that to make a DHTML menu? anyone have any experience

Muchos Thank You's

Steve



~|
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:84
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: Recursion anyone?

2005-10-26 Thread Thomas Chiverton
On Wednesday 26 October 2005 11:15, Stephen Whiteley wrote:
> know how to recurse through an adjacency list model table, of the following
> setup
>
> ID CategoryName ParentItemID

topLevel=getNodesWithNoParent()
foreach thisNode in topLevel{
print thisNode
getChildren(thisNode)
}

function getChildren(aNode){
childList=getChildrenOf(aNode);
foreach aNode on childList{
print aNode
getChildren(aNode)
}
}

getNodesWithNoParent() is easy.

-- 

Tom Chiverton 
Advanced ColdFusion Programmer

~|
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:83
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: Recursion and Breadcrumbs

2003-12-03 Thread Andre Turrettini
Jake, I did something that might help you.  Its a recursive function that
uses one db call.  You can see it at work by creating an account and
creating a survey here.  www.surveys.theanticool.com
 .  The interface to create the survey
uses only ie at this point(I know I know!).  You can see the results of the
nested tree structure as the shape of the survey.  Check it out and write
back to me at [EMAIL PROTECTED]   if you want
more details.  I'll get back to you tonight.

 
DRE

-Original Message-
From: Jake . [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 25, 2003 1:22 PM
To: CF-Talk
Subject: Re:Recursion and Breadcrumbs

Really need a dynamic, DB driven solution. I will check out that site
though.

Jake

>if ur using dw then just use an extension, takes 5 seconds to do. or once
>again go to www.dwfaq.com and go to snippetts and massimo has a few
>breadcrumb snippetts there 
  _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Recursion and Breadcrumbs

2003-11-25 Thread Dominik Schlaepfer
Jake

No it does not! In the lower section of the article, just over the source code of the recursive Custom Tag, it is written: "To get  to put the items in any other order, you would have to completely reorganize your database, and nobody wants to do that.  An alternative to hours of swapping ItemID's is to use a small, recursive, custom tag.  For example:" And here comes your solution without any CFX-Tag.

HTH 

Dominik

-Original Message-
From: Jake . [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 8:36 PM
To: CF-Talk
Subject: Re:Recursion and Breadcrumbs

The problem with that article is that it uses the CF_MakeTree tag, which I'm not able to use. 

Any other ideas?

>There is an article about recursion from Steve Majewski on defusion.
>com. I think this article answers your questions.
>http://www.defusion.com/articles/index.cfm?ArticleID=63

 
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Recursion and Breadcrumbs

2003-11-25 Thread Dominik Schlaepfer
Hi Jake

There is an article about recursion from Steve Majewski on defusion.com. I think this article answers your questions.
http://www.defusion.com/articles/index.cfm?ArticleID=63

HTH 

Dominik

-Original Message-
From: Jake McKee [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 7:51 PM
To: CF-Talk
Subject: Recursion and Breadcrumbs

After searching high and low, I've found quite a few discussions about
using recursion to create breadcrumbs, and other nested "categorical"
info. It seems to be a pretty common question, and I would expect that
there is a common solution out there, but I can't seem to find one. 

I'm trying to display:

Home > Cat > Sub Cat > Sub Sub Cat > .. Etc.

My DB table looks like :

Cat ID   CatName   ParentCatID

-   -   -

1  CDs  0

2  Good CDs 1

3  Bad CDs   1

4  U22

5  Nsync   3

This would display:

Home > CDs > Good CDs > U2

Anyone have a straightforward code snippet for this?

Thanks!
Jake

--

My Blog -   www.countersinkdg.com 




 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Recursion and Breadcrumbs

2003-11-24 Thread Hagan, Ryan Mr (Contractor ACI)
This is what I generally use.  Let me know if you need clarification.


 

 
 

 
username="#request.dsn.user#" password="#request.dsn.pass#">
 SELECT catId, parentCatId, catName
 FROM item_categories
 WHERE parentId = #arguments.myCatId# 
 ORDER BY category
 

 
  
  
)>
 

 

 


-Original Message-
From: Jake McKee [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 1:51 PM
To: CF-Talk
Subject: Recursion and Breadcrumbs

After searching high and low, I've found quite a few discussions about
using recursion to create breadcrumbs, and other nested "categorical"
info. It seems to be a pretty common question, and I would expect that
there is a common solution out there, but I can't seem to find one. 

I'm trying to display:

Home > Cat > Sub Cat > Sub Sub Cat > .. Etc.

My DB table looks like :

Cat ID   CatName   ParentCatID

-   -   -

1  CDs  0

2  Good CDs 1

3  Bad CDs   1

4  U22

5  Nsync   3

This would display:

Home > CDs > Good CDs > U2

Anyone have a straightforward code snippet for this?

Thanks!
Jake

--

My Blog -   www.countersinkdg.com 


  _  


 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Recursion and Scope problem?

2003-09-18 Thread Andre Turrettini
basically, you call the function once and the vars are declared in the
global scope, when that function calls itself, it redeclares them again in
that same global scope, so they are overwritten.  So, when the top function
continues, its variables are no longer the ones it set.  Using the var
statement simply keeps each declaration seperate.  Make sense?

DRE

-Original Message-
From: Cedric Villat [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 11:13 AM
To: CF-Talk
Subject: Re:Recursion and Scope problem?


Bingo, worked like a champ. But I'm still wondering WHY the scopes be
overwritten? I just don't get it

Cedric

>Try using the "var" keyword in your first four  statements.
>
>
>
>
>-Original Message-
>From: Cedric Villat [mailto:[EMAIL PROTECTED]
>Sent: Thursday, September 18, 2003 12:59 PM
>To: CF-Talk
>Subject: Recursion and Scope problem?
>
>
>Ok, I'm doing a bit of recursion, and my variables seem to be overwriting
>themselves, which makes no sense to me. Here is my code:
>
>
> 
> 
>
> 
> 
> 
> 
>
> 
>  
>  
> ArrayLen(children[root_node]) LTE 0>
>  
>  
> 
>  
>   
>  
> 
>
> 
>
>
>
>In this example, the root_node is "Homer Simpson". He has 3 children Bart,
>Lisa, and Maggie. When the function is first run, Arguments.node is "Homer
>Simpson". It goes through the code until it gets to the recursive call
>getDTreeWidth() which then calls itself for each child. After calling
>getDTreeWidth() for Bart, it seems to work. When the function returns a
>number and is added to the width, the next time through Homer Simpson's
>loop, the root_node is now "Bart Simpson"! How could the recursive call to
>Bart Simpson overwrite Homer Simpson's original arguments? Is this a bug or
>am I missing something here?
>
>Any help would be appreciated. It may not make sense, so let me know if you
>need some more clarification.
>
>Cedric
>
>
>

~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137564
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com


RE: Recursion and Scope problem?

2003-09-18 Thread Hagan, Ryan Mr (Contractor ACI)
As I understand it ( and I'll be quickly corrected if I'm wrong ), here's
how scope works.

In a CF page, all variables on that page (and 'd pages) have the
same "Global" scope...functions included.  By using the "var" keyword,
you're telling CF to make the declared variable private scope of the
function it was called in.  Another scope issue that I've run across is that
function arguments () always have their own, unique scope and
will not be overwritten in a recursive function call.


-Original Message-
From: Cedric Villat [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 1:13 PM
To: CF-Talk
Subject: Re:Recursion and Scope problem?


Bingo, worked like a champ. But I'm still wondering WHY the scopes be
overwritten? I just don't get it

Cedric

>Try using the "var" keyword in your first four  statements.
>
>
>
>
>-Original Message-
>From: Cedric Villat [mailto:[EMAIL PROTECTED]
>Sent: Thursday, September 18, 2003 12:59 PM
>To: CF-Talk
>Subject: Recursion and Scope problem?
>
>
>Ok, I'm doing a bit of recursion, and my variables seem to be overwriting
>themselves, which makes no sense to me. Here is my code:
>
>
> 
> 
>
> 
> 
> 
> 
>
> 
>  
>  
> ArrayLen(children[root_node]) LTE 0>
>  
>  
> 
>  
>   
>  
> 
>
> 
>
>
>
>In this example, the root_node is "Homer Simpson". He has 3 children Bart,
>Lisa, and Maggie. When the function is first run, Arguments.node is "Homer
>Simpson". It goes through the code until it gets to the recursive call
>getDTreeWidth() which then calls itself for each child. After calling
>getDTreeWidth() for Bart, it seems to work. When the function returns a
>number and is added to the width, the next time through Homer Simpson's
>loop, the root_node is now "Bart Simpson"! How could the recursive call to
>Bart Simpson overwrite Homer Simpson's original arguments? Is this a bug or
>am I missing something here?
>
>Any help would be appreciated. It may not make sense, so let me know if you
>need some more clarification.
>
>Cedric
>
>
>

~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137537
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com


RE: Recursion and Scope problem?

2003-09-18 Thread Ian Skinner
Because you where using the default scope that can be seen by default all
functions can see.  The Var keyword declares the scope private to the
function alone.  

--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA


-Original Message-
From: Cedric Villat [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 10:13 AM
To: CF-Talk
Subject: Re:Recursion and Scope problem?


Bingo, worked like a champ. But I'm still wondering WHY the scopes be
overwritten? I just don't get it

Cedric

>Try using the "var" keyword in your first four  statements.
>
>
>
>
>-Original Message-
>From: Cedric Villat [mailto:[EMAIL PROTECTED]
>Sent: Thursday, September 18, 2003 12:59 PM
>To: CF-Talk
>Subject: Recursion and Scope problem?
>
>
>Ok, I'm doing a bit of recursion, and my variables seem to be overwriting
>themselves, which makes no sense to me. Here is my code:
>
>
> 
> 
>
> 
> 
> 
> 
>
> 
>  
>  
> ArrayLen(children[root_node]) LTE 0>
>  
>  
> 
>  
>   
>  
> 
>
> 
>
>
>
>In this example, the root_node is "Homer Simpson". He has 3 children Bart,
>Lisa, and Maggie. When the function is first run, Arguments.node is "Homer
>Simpson". It goes through the code until it gets to the recursive call
>getDTreeWidth() which then calls itself for each child. After calling
>getDTreeWidth() for Bart, it seems to work. When the function returns a
>number and is added to the width, the next time through Homer Simpson's
>loop, the root_node is now "Bart Simpson"! How could the recursive call to
>Bart Simpson overwrite Homer Simpson's original arguments? Is this a bug or
>am I missing something here?
>
>Any help would be appreciated. It may not make sense, so let me know if you
>need some more clarification.
>
>Cedric
>
>
>

~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137535
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm


RE: Recursion and Scope problem?

2003-09-18 Thread Hagan, Ryan Mr (Contractor ACI)
Try using the "var" keyword in your first four  statements.


mailto:[EMAIL PROTECTED]
Sent: Thursday, September 18, 2003 12:59 PM
To: CF-Talk
Subject: Recursion and Scope problem?


Ok, I'm doing a bit of recursion, and my variables seem to be overwriting
themselves, which makes no sense to me. Here is my code:


 
 

 
 
 
 

 
  
  
 
  
  
 
  
   
  
 

 



In this example, the root_node is "Homer Simpson". He has 3 children Bart,
Lisa, and Maggie. When the function is first run, Arguments.node is "Homer
Simpson". It goes through the code until it gets to the recursive call
getDTreeWidth() which then calls itself for each child. After calling
getDTreeWidth() for Bart, it seems to work. When the function returns a
number and is added to the width, the next time through Homer Simpson's
loop, the root_node is now "Bart Simpson"! How could the recursive call to
Bart Simpson overwrite Homer Simpson's original arguments? Is this a bug or
am I missing something here?

Any help would be appreciated. It may not make sense, so let me know if you
need some more clarification.

Cedric



~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137532
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com


Re: recursion in cold fusion ( was RE: Creating a list with infinite groupings and indents )

2003-07-09 Thread Jochem van Dieten
Hagan, Ryan Mr (Contractor ACI) wrote:
> 
> I personally like this solution quite a bit.  I know it has performance
> issues, but I've never noticed any significant impact on server response,
> even under heavy load.

I think it is an ugly workaround. SQL is a set oriented language and the 
best way to use that is by getting the whole set at once. Furthermore it 
is important to keep in mind that your solution does not guarantee to 
return the same order every time.


> First and foremost, we can't run queries inside of  tags.  Bummer.

Declare your cfquery as a .


> Second, even if the query issue were resolved (and if you've got ideas for
> work-arounds, I'd love to hear them), you've now got variable scope issues.
> A variable declared in a CFMX page is global (correct me if I'm wrong) to
> the entire page, even inside of functions.

Wouldn't  solve that?


> So where does that leave us?  I'd be interested in some info on CFMX CFCs.
> Can I use recursion in a CFC function?

Sure you can.


> A lot of problems that are solved with recursion can be rewritten using
> while loops.  For this particular problem, though, I've not been able to
> come up with a non-recursive solution (assuming the above table structure).
> Can anyone help me here?

So don't use that table structure :-)

Use a nested set model, or use a 2 table model where one table holds 
complete trees in an XMLData field (which you only need to edit when a 
new element is inserted) and one holds individual messages but with an 
FK to the table that holds the complete trees in XML.
I usually prefer the first solution, but in some cases the latter 
solution allows you to offload the whole thing to the client and let the 
client figure it out using XSLT. Something like: 
http://spike.oli.tudelft.nl/jochemd/test/tree/test.xml

Jochem



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: recursion in cold fusion ( was RE: Creating a list with infinite groupings and indents )

2003-07-09 Thread Barney Boisvert
Worth mentioning that you can use custom tags in a recursive manner.  I have
several recursive tree generators on various versions of CF that use custom
tags, UDFs and CFC methods.  custom tags and CFFUCTION-based UDFs (including
CFCs) can have CFQUERY tags in them, although if you're making a query
within a recusive call, you're just asking for performance issues.  Might be
unavoidable for certain situations, but it's just as bad as putting a
CFQUERY inside a loop.

barneyb

---
Barney Boisvert, Senior Development Engineer
AudienceCentral
[EMAIL PROTECTED]
voice : 360.756.8080 x12
fax   : 360.647.5351

www.audiencecentral.com


> -Original Message-
> From: Paul Hastings [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 09, 2003 1:33 PM
> To: CF-Talk
> Subject: Re: recursion in cold fusion ( was RE: Creating a list with
> infinite groupings and indents )
>
>
> > First and foremost, we can't run queries inside of  tags.
> Bummer.
>
> easy enough with a wrapper function.
>
> > Second, even if the query issue were resolved (and if you've
> got ideas for
> > work-arounds, I'd love to hear them), you've now got variable scope
> issues.
> > A variable declared in a CFMX page is global (correct me if I'm
> wrong) to
>
> you can make variables private to a function, at least as i understand it.
>
>
>
> 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: recursion in cold fusion ( was RE: Creating a list with infinite groupings and indents )

2003-07-09 Thread Sean A Corfield
On Wednesday, Jul 9, 2003, at 13:13 US/Pacific, Hagan, Ryan Mr 
(Contractor ACI) wrote:
> function list_categories( $parentId, $level ) {





>   global $database, $connection;  
>   $numSpaces = 5;






>   $query = "SELECT * FROM myTable WHERE parentId = " . $parentId;
>   $result = mysql_query($query, $connection);


SELECT * FROM myTable WHERE parentId = #arguments.parentId#


>   while( $row = mysql_fetch_assoc( $result ) ) {



>   // output spaces for proper indentation
>   for ( $spaces=0; $spaces<=($level*$numSpaces); $spaces++ )



>   echo ' ';





>   echo '\n';



>   list_categories( $row["itemId"], $level+1 );



>   }



> }
>
> // list entire table in tree format
> list_categories( 0, 0 );



> I'd love to be able to write this code in CFMX, but for several 
> reasons,
> it's just not possible.

See above. Untested but it should be pretty close.

> First and foremost, we can't run queries inside of  tags.  
> Bummer.

So write the function using tags as above.

> Second, even if the query issue were resolved (and if you've got ideas 
> for
> work-arounds, I'd love to hear them), you've now got variable scope 
> issues.

Not a problem - see above.

> A variable declared in a CFMX page is global (correct me if I'm wrong) 
> to
> the entire page, even inside of functions.

Yes, it's in the "variables" scope. The solution is to use "var" to 
declare local variables in a function.

> In other words, unlike PHP, CFMX
> functions do not have their own scope separate from the rest of the 
> page

Wrong - see above.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: recursion in cold fusion ( was RE: Creating a list with infinite groupings and indents )

2003-07-09 Thread Paul Hastings
> First and foremost, we can't run queries inside of  tags.
Bummer.

easy enough with a wrapper function.

> Second, even if the query issue were resolved (and if you've got ideas for
> work-arounds, I'd love to hear them), you've now got variable scope
issues.
> A variable declared in a CFMX page is global (correct me if I'm wrong) to

you can make variables private to a function, at least as i understand it.



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: recursion in cold fusion ( was RE: Creating a list with infin ite groupings and indents )

2003-07-09 Thread Ian Skinner
I've done what you have done here with both CFC's and before the Custom
Tags.  It's fairly easy to right a recursive custom tag, since each call to
the tag gets it's own attributes scope.

This one is recursing over a Structure creating an indented tree select
list.  It could easily be modified to do the same thing over a query or any
other complex data type.


*** Recursive Custom Tag ***




#Attributes.Spacer##i#)
#Attributes.Areas[Attributes.Parent][i]["Name"]#








 END 

--
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA


-Original Message-
From: Hagan, Ryan Mr (Contractor ACI)
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 1:14 PM
To: CF-Talk
Subject: recursion in cold fusion ( was RE: Creating a list with
infinite groupings and indents )


This brings up an interesting question for me.  I tend to use recursive
functions frequently, and have even had to solve a problem very similar to
the original question posed in this thread.  My take on the solution is the
following (in php):


itemIDitemparentID
--
 1root   0
 21st level 11
 31st level 21
 41st level 31
 52nd level 1 1  2
 62nd level 1 2  2
 72nd level 3 1  4
etc...

function list_categories( $parentId, $level ) {
global $database, $connection;  
$numSpaces = 5;
$query = "SELECT * FROM myTable WHERE parentId = " . $parentId;
$result = mysql_query($query, $connection);
while( $row = mysql_fetch_assoc( $result ) ) {
// output spaces for proper indentation
for ( $spaces=0; $spaces<=($level*$numSpaces); $spaces++ )
echo ' ';
echo '\n';
list_categories( $row["itemId"], $level+1 );
}
}

// list entire table in tree format
list_categories( 0, 0 );



I personally like this solution quite a bit.  I know it has performance
issues, but I've never noticed any significant impact on server response,
even under heavy load.  To me, this is very clean and very readable code.
I'd love to be able to write this code in CFMX, but for several reasons,
it's just not possible.

First and foremost, we can't run queries inside of  tags.  Bummer.

Second, even if the query issue were resolved (and if you've got ideas for
work-arounds, I'd love to hear them), you've now got variable scope issues.
A variable declared in a CFMX page is global (correct me if I'm wrong) to
the entire page, even inside of functions.  In other words, unlike PHP, CFMX
functions do not have their own scope separate from the rest of the page, so
in the above recursive function, I would be clobbering my "$result" variable
each time through the recursion.  I've got a workaround for this, but won't
go into here, just making a quick point.


So where does that leave us?  I'd be interested in some info on CFMX CFCs.
Can I use recursion in a CFC function?  If I could, it would certainly fix
the "no queries in " problem, however it seems as if it would
break all sorts of "good practice" rules for CFCs.  How about the second
point above?  Do CFCs have their own variable scope separate from the
calling page (and itself in the case of recursion)?

A lot of problems that are solved with recursion can be rewritten using
while loops.  For this particular problem, though, I've not been able to
come up with a non-recursive solution (assuming the above table structure).
Can anyone help me here?

Thanks for any and all insight into handling recursion in Cold Fusion.


-Original Message-
From: Sarah [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 1:42 PM
To: CF-Talk
Subject: RE: Creating a list with infinite groupings and indents


I think this is pretty much the same thing that others have pointed you 
towards, but I think this article might be easier to read:
http://www.sitepoint.com/article/1105

Sarah



At 7/9/2003 11:10 AM, you wrote:
>BTW Joe Clecko had an entire book on trees coming soon
>
>"TREES & HIERARCHIES IN SQL (Morgan-Kaufmann), 2003"
>
>http://www.celko.com/books.htm
>
>WG
>
>
>-Original Message-
>From: Michael T. Tangorre [mailto:[EMAIL PROTECTED]
>Sent: 09 July 2003 14:48
>To: CF-Talk
>Subject: Re: Creating a list with infinite groupings and indents
>
>
>First off... the way you have it setup now will only allow for two levels..
>level 1 and level 2. To get the ability you are after (tree type
strucutre),
>you need to get into nested sets. Joe Celko has done some awesome work in
>this area and the links below may help you out. It is a bit tricky at
first,
>but once you get it, it is very powerful. The sql statements for
>adding/removing/updating "children" or "paren

Re: Recursion Tutorial?

2003-05-30 Thread Chris Montgomery
Some more links on recursion I just found:

http://cfhub.com/advanced/customtags/recursion.cfm

http://www.cfhub.com/tutorials/ftp2tree/recursion.cfm

In addition, you might want to search the CF-Talk archives for the
following subject lines:
"CF recursive question"
"Recursive parent/child relationships"
"How to make recursion in CF"
"HELP: Hierarchy"
"Content -Threading?"
"Recursion in CF"

Most of the above threads that I saved were in 2000/2001, don't know how
far back Michael's archives go.

-- 
Chris Montgomery
Airtight Web Services   http://www.airtightweb.com
Web Development, Web Project Management, Software Sales
210-490-2415
AIM: Airtightweb

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Recursion Tutorial?

2003-05-29 Thread webguy
BTW the king of Modelling trees in DBs, Joe Celko
(http://www.celko.com/books.htm) , has got an entire book on the subject
coming out, soon
It calles TREES & HIERARCHIES IN SQL 

WG

-Original Message-
From: Chris Montgomery [mailto:[EMAIL PROTECTED]
Sent: 29 May 2003 05:04
To: CF-Talk
Subject: Re: Recursion Tutorial?


Howdy Jake,

Tuesday, May 27, 2003, 11:16:23 PM, Jake McKee wrote:

> ... I am looking for good sources of help/tutorial on recursion. ...

Here's some links I've collected. Most of them relate to hierarchical
database design but you may find them useful anyway. The last article
shows a way to do recursion in CF using a custom tag (which I've used a
couple of times). Anyway, I hope these help.

http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/404
7/index.html

http://www.4guysfromrolla.com/webtech/sqlguru/q121799-1.shtml

http://www.4guysfromrolla.com/webtech/sqlguru/q120899-1.shtml

http://www.dbmsmag.com/9603d06.html

http://www.dbmsmag.com/9604d06.html

http://www.dbmsmag.com/9605d06.html

http://www.sqlmag.com/Articles/Index.cfm?ArticleID=15715

http://www.intelligententerprise.com/001020/celko.shtml

http://www.intelligententerprise.com/001020/celko1_1.shtml

http://www.intelligententerprise.com/010918/414warehouse1_1.shtml/bi%7Cbusin
tel

http://www.databasejournal.com/features/mssql/article.php/1477481

http://www.sqlteam.com/item.asp?ItemID=1602

http://www.sqlteam.com/item.asp?ItemID=1353

http://www.onlamp.com/pub/a/onlamp/2001/07/12/aboutSQL.html

http://www.sqlteam.com/item.asp?ItemID=8866

http://www.sitepoint.com/article.php/1105

http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci537290,00.html

http://www.defusion.com/articles/index.cfm?ArticleID=63

--
Chris Montgomery
Airtight Web Services   http://www.airtightweb.com
Web Development, Web Project Management, Software Sales
210-490-2415
AIM: Airtightweb


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: Recursion Tutorial?

2003-05-29 Thread Chris Montgomery
Howdy Jake,

Tuesday, May 27, 2003, 11:16:23 PM, Jake McKee wrote:

> ... I am looking for good sources of help/tutorial on recursion. ...

Here's some links I've collected. Most of them relate to hierarchical
database design but you may find them useful anyway. The last article
shows a way to do recursion in CF using a custom tag (which I've used a
couple of times). Anyway, I hope these help.

http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/index.html

http://www.4guysfromrolla.com/webtech/sqlguru/q121799-1.shtml

http://www.4guysfromrolla.com/webtech/sqlguru/q120899-1.shtml

http://www.dbmsmag.com/9603d06.html

http://www.dbmsmag.com/9604d06.html

http://www.dbmsmag.com/9605d06.html

http://www.sqlmag.com/Articles/Index.cfm?ArticleID=15715

http://www.intelligententerprise.com/001020/celko.shtml

http://www.intelligententerprise.com/001020/celko1_1.shtml

http://www.intelligententerprise.com/010918/414warehouse1_1.shtml/bi%7Cbusintel

http://www.databasejournal.com/features/mssql/article.php/1477481

http://www.sqlteam.com/item.asp?ItemID=1602

http://www.sqlteam.com/item.asp?ItemID=1353

http://www.onlamp.com/pub/a/onlamp/2001/07/12/aboutSQL.html

http://www.sqlteam.com/item.asp?ItemID=8866

http://www.sitepoint.com/article.php/1105

http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci537290,00.html

http://www.defusion.com/articles/index.cfm?ArticleID=63

-- 
Chris Montgomery
Airtight Web Services   http://www.airtightweb.com
Web Development, Web Project Management, Software Sales
210-490-2415
AIM: Airtightweb

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: Recursion Tutorial?

2003-05-27 Thread Pablo Varando
http://www.easycfm.com

;)
Pablo
- Original Message - 
From: "Jake McKee" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, May 27, 2003 11:16 PM
Subject: Recursion Tutorial?


> Hi there, I am hoping someone can point me in the right direction. I am
> looking for good sources of help/tutorial on recursion. I understand the
> basic concept of setting up the database, but I tend to have problems
> making it work in real life code.
>
>
>
> Can anyone point me to some good examples/tutorials/help of any kind?
> (Hopefully focused around CF and CFC, but general DB techniques would be
> OK too)
>
>
>
> Thanks in advance!
> Jake
>
>
>
> --
>
>
>
>
> 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: Recursion

2002-09-13 Thread Robert Polickoski

All,

Thank you again for all of your suggestions.  As time allows, I will probably play 
with all of them just to learn how.

It is wonderful to have such support.

Take care,
Robert

-- Original Message --
From: S. Isaac Dealey <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date:  Fri, 13 Sep 2002 08:56:59 -0400

>> S. Isaac Dealey wrote:
>>> Before you give up... There's a couple of things you can
>>> do for the
>>> recursion in the db... One is to create a cross-reference
>>> table which shows
>>> the parent-child relationship between all records in the
>>> table...
>>> Alternatively, you could try this:
>>>
>>> 
>>> 
>>> 
>>> 
>>>
>>> 
>>> 
>>> SELECT * FROM mytable
>>> WHERE parentid IN (#valuelist(rs.id)#)
>>> 
>>> SELECT * FROM rs UNION SELECT * FROM rs2
>>> 
>>> 
>>>
>>> This or something like it ought to give you a single
>>> query containing all of
>>> the children of the parent... It will be much slower than
>>> a cross-reference
>>> table in the db, however, it should be similar in
>>> performance to the current
>>> solution... Once you have this query, however, you can
>>> then use the
>>> recursive UDF in CF 5 and either pass the query to the
>>> UDF along with the
>>> current parent id for the tree, or you can place the
>>> query in the request
>>> scope and reference it from there...
>>
>> never do to much work in cf when your database can do it
>> faster
>
>Well, that's why I recommended that a cross-reference table would be
>faster... :) All my recursion is done using the NTM model described by that
>guy who wrote the book "SQL for Smarties" ... don't remember his name --
>never actually read the book -- discovered the method was documented after I
>had figured out how to do it on my own... But if the page in question
>doesn't see huge amounts of traffic, or if the tree structure isn't
>tremendously deep ( width isn't much of a problem ) then it's not wholly
>unreasonable in terms of performance to do it in cf as above...
>
>
>Isaac
>Certified Advanced ColdFusion 5 Developer
>
>www.turnkey.to
>954-776-0046
>
>
__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion

2002-09-13 Thread S . Isaac Dealey

> S. Isaac Dealey wrote:
>> Before you give up... There's a couple of things you can
>> do for the
>> recursion in the db... One is to create a cross-reference
>> table which shows
>> the parent-child relationship between all records in the
>> table...
>> Alternatively, you could try this:
>>
>> 
>> 
>> 
>> 
>>
>> 
>>  
>>  SELECT * FROM mytable
>>  WHERE parentid IN (#valuelist(rs.id)#)
>>  
>>  SELECT * FROM rs UNION SELECT * FROM rs2
>>  
>> 
>>
>> This or something like it ought to give you a single
>> query containing all of
>> the children of the parent... It will be much slower than
>> a cross-reference
>> table in the db, however, it should be similar in
>> performance to the current
>> solution... Once you have this query, however, you can
>> then use the
>> recursive UDF in CF 5 and either pass the query to the
>> UDF along with the
>> current parent id for the tree, or you can place the
>> query in the request
>> scope and reference it from there...
>
> never do to much work in cf when your database can do it
> faster

Well, that's why I recommended that a cross-reference table would be
faster... :) All my recursion is done using the NTM model described by that
guy who wrote the book "SQL for Smarties" ... don't remember his name --
never actually read the book -- discovered the method was documented after I
had figured out how to do it on my own... But if the page in question
doesn't see huge amounts of traffic, or if the tree structure isn't
tremendously deep ( width isn't much of a problem ) then it's not wholly
unreasonable in terms of performance to do it in cf as above...


Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-13 Thread Adam Reynolds

hat



> -Original Message-
> From: Rich Wild [mailto:[EMAIL PROTECTED]]
> Sent: 13 September 2002 10:56
> To: CF-Talk
> Subject: RE: Recursion
> 
> 
> > I think UDFs do not do recursion.
> 
> not true.
> 
> nice example:
> 
> http://www.cflib.org/udf.cfm?ID=600
> 
> 
__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-13 Thread Rich Wild

> I think UDFs do not do recursion.

not true.

nice example:

http://www.cflib.org/udf.cfm?ID=600

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-13 Thread Adam Reynolds

I think UDFs do not do recursion.

The moment you return a value from nested UDFs it finishes the whole stack.

I found that cfmodule can be very good.

If you are making a lot of recursive calls to get the same result set, then
it is very very important to store the result set inside a structure (say at
application level).

I found this particularly useful when generating personalised site
navigation generated from a database. It made a massive boost to
performance.


> -Original Message-
> From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
> Sent: 12 September 2002 20:11
> To: CF-Talk
> Subject: Re: Recursion
>
>
>   Rewrite the function using the CFScript UDF syntax.  Theoretically it
> should work fine, but it may depend on what you are doing inside the
> CFFunction tag.
>
> At 01:31 PM 9/13/2002 +0600, you wrote:
> >Hello all,
> >
> >I wrote this really neat recursive function using the
>  tag on
> >my development system which is running CFMX on WindowsXP Pro.  When I
> >ported to the operational host (third party), I discovered that
> they were
> >running a previous version of CF (I do not know which) which does not
> >support the new tag.  Does anybody know how to do recursion without the
> > tag?
> >
> >Thank you!
> >
> >--
> >Respectfully,
> >
> >Robert J. Polickoski, CNA
> >Lead Programmer
> >(540) 842-6339
> >[EMAIL PROTECTED]
> >AIM: RobertJFP
> >Windows Messenger: RPolickoski
> >--
> >
> 
__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion

2002-09-13 Thread Zac Spitzer

S. Isaac Dealey wrote:
> Before you give up... There's a couple of things you can do for the
> recursion in the db... One is to create a cross-reference table which shows
> the parent-child relationship between all records in the table...
> Alternatively, you could try this:
> 
> 
> 
> 
> 
> 
> 
>   
>   SELECT * FROM mytable
>   WHERE parentid IN (#valuelist(rs.id)#)
>   
>   SELECT * FROM rs UNION SELECT * FROM rs2
>   
> 
> 
> This or something like it ought to give you a single query containing all of
> the children of the parent... It will be much slower than a cross-reference
> table in the db, however, it should be similar in performance to the current
> solution... Once you have this query, however, you can then use the
> recursive UDF in CF 5 and either pass the query to the UDF along with the
> current parent id for the tree, or you can place the query in the request
> scope and reference it from there...

never do to much work in cf when your database can do it faster

http://www.sqlteam.com/item.asp?ItemID=8866 is a really nice and simple 
method for doing trees it stores an id path for each node in your 
tree, automatically, that why you can do a query like (see example on 
page above) select node where lineage contains '/#target_node_id#' to 
return a specific part of the tree

z

> 
> 
> hth
> 
> Isaac
> Certified Advanced ColdFusion 5 Developer
> 
> www.turnkey.to
> 954-776-0046
> 
> 
>>All,
> 
> 
>>Thank you for your responses to my inquiry.
> 
> 
>>As it turns out, the CFSCRIPT option is not viable because
>>the point of the recursion was querying a database for
>>records that represented subordinate records which might
>>have subordinate records of their own.
> 
> 
>>The cfmodule seems to take forever and therefore is not
>>practical.
> 
> 
>>In the end, I will have to change the design of the
>>application.  However, that is not necessarily a bad
>>thing.  However, it does make me appreciate the changes in
>>CFMX.
> 
> 
>>Again, thank you all for your responses.
> 
> 
> 
> 
>>-- Original Message
>>--
>>From: Mosh Teitelbaum <[EMAIL PROTECTED]>
>>Reply-To: [EMAIL PROTECTED]
>>Date:  Thu, 12 Sep 2002 15:45:57 -0400
> 
> 
>>>Or, you could rewrite the function without recursion.
>>>Just thought I'd
>>>mention it as another alternative.
>>>
>>
> 
>>>--
>>>Mosh Teitelbaum
>>>evoch, LLC
>>>Tel: (301) 625-9191
>>>Fax: (301) 933-3651
>>>Email: [EMAIL PROTECTED]
>>>WWW: http://www.evoch.com/
>>>
>>>
>>>
>>>>-Original Message-
>>>>From: Dave Watts [mailto:[EMAIL PROTECTED]]
>>>>Sent: Thursday, September 12, 2002 2:23 PM
>>>>To: CF-Talk
>>>>Subject: RE: Recursion
>>>>
>>>>
>>>>
>>>>>I wrote this really neat recursive function using the
>>>>> tag on my development system which is
>>>>>running
>>>>>CFMX on WindowsXP Pro.  When I ported to the
>>>>>operational host
>>>>>(third party), I discovered that they were running a
>>>>>previous
>>>>>version of CF (I do not know which) which does not
>>>>>support
>>>>>the new tag.  Does anybody know how to do recursion
>>>>>without
>>>>>the  tag?
>>>>
>>>>If your recursive function is relatively simple, you can
>>>>probably write it
>>>>as a CF 5-compliant user-defined function, using
>>>>CFSCRIPT.
>>>>CFSCRIPT is a tag
>>>>in which you can write CF commands using a
>>>>JavaScript-like language, which
>>>>uses the same syntax and control flow structures as
>>>>JavaScript, but uses
>>>>CFML operators and expressions. You can't use CFML tags
>>>>within a CFSCRIPT
>>>>tag, though, and CFSCRIPT doesn't support all the things
>>>>you can do with
>>>>CFML tags, such as querying a database. Keep in mind
>>>>that the host would
>>>>have to be using CF 5 or higher for this to work.
>>>>
>>>>Alternatively, you could write a recursive custom tag.
>>>>However,
>>>>this is the
>>>>least desirable alternative, as custom tags don't
>>>>provide any built-in
>>>>ability to return values

RE: Recursion

2002-09-12 Thread Joe Eugene

Robert,
Recursion in every language is going to be slow and is a bad practice
unless
you have no other way of implementing the code. ColdFusion does not
necessarily have a strong type for objects.. so its even going to be
slower.
If you have no other means.. i would suggest you write your recursive
funtions in Java.. plain old class...you will get scalabilty you are
looking for
and its easy to deploy it on CFMX
Joe
Certified Advanced ColdFusion Developer
[EMAIL PROTECTED]

> -Original Message-
> From: Robert Polickoski [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 13, 2002 1:41 PM
> To: CF-Talk
> Subject: RE: Recursion
>
>
> All,
>
> Thank you for your responses to my inquiry.
>
> As it turns out, the CFSCRIPT option is not viable because the
> point of the recursion was querying a database for records that
> represented subordinate records which might have subordinate
> records of their own.
>
> The cfmodule seems to take forever and therefore is not practical.
>
> In the end, I will have to change the design of the application.
> However, that is not necessarily a bad thing.  However, it does
> make me appreciate the changes in CFMX.
>
> Again, thank you all for your responses.
>
>
>
> -- Original Message --
> From: Mosh Teitelbaum <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date:  Thu, 12 Sep 2002 15:45:57 -0400
>
> >Or, you could rewrite the function without recursion.  Just thought I'd
> >mention it as another alternative.
> >
> >--
> >Mosh Teitelbaum
> >evoch, LLC
> >Tel: (301) 625-9191
> >Fax: (301) 933-3651
> >Email: [EMAIL PROTECTED]
> >WWW: http://www.evoch.com/
> >
> >
> >> -Original Message-
> >> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> >> Sent: Thursday, September 12, 2002 2:23 PM
> >> To: CF-Talk
> >> Subject: RE: Recursion
> >>
> >>
> >> > I wrote this really neat recursive function using the
> >> >  tag on my development system which is running
> >> > CFMX on WindowsXP Pro.  When I ported to the operational host
> >> > (third party), I discovered that they were running a previous
> >> > version of CF (I do not know which) which does not support
> >> > the new tag.  Does anybody know how to do recursion without
> >> > the  tag?
> >>
> >> If your recursive function is relatively simple, you can
> probably write it
> >> as a CF 5-compliant user-defined function, using CFSCRIPT.
> >> CFSCRIPT is a tag
> >> in which you can write CF commands using a JavaScript-like
> language, which
> >> uses the same syntax and control flow structures as
> JavaScript, but uses
> >> CFML operators and expressions. You can't use CFML tags within
> a CFSCRIPT
> >> tag, though, and CFSCRIPT doesn't support all the things you
> can do with
> >> CFML tags, such as querying a database. Keep in mind that the
> host would
> >> have to be using CF 5 or higher for this to work.
> >>
> >> Alternatively, you could write a recursive custom tag. However,
> >> this is the
> >> least desirable alternative, as custom tags don't provide any built-in
> >> ability to return values (you can write that ability into your
> >> code, though)
> >> and they tend to negatively affect performance. Nevertheless,
> if you need
> >> recursion and you're using a version of CF prior to 5, that's
> the only way
> >> you can do it within CFML.
> >>
> >> Dave Watts, CTO, Fig Leaf Software
> >> http://www.figleaf.com/
> >> voice: (202) 797-5496
> >> fax: (202) 797-5444
> >>
> >>
> >
> 
__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-12 Thread Mosh Teitelbaum

Robert:

If the point of the recursion was to traverse a hierarchical structure in a
database, than you might want to move that part of the code to the database.
How you would accomplish this depends on the database platform that you are
using.  Oracle supports a CONNECT BY clause in SELECT statements that makes
single-parent hierarchy traversal a snap.  In SQL-Server & Sybase, you could
write a stored procedure that performs the recursion for you.  In Access,
you can probably write a macro or something.

The benefit to this is that you make only a single call to the DB, you end
up with a single query result set containing all of your data, and you
offload data processing responsibilities to the server that knows how to
best process data.

Good luck.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 625-9191
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/


> -Original Message-
> From: Robert Polickoski [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 13, 2002 1:41 PM
> To: CF-Talk
> Subject: RE: Recursion
>
>
> All,
>
> Thank you for your responses to my inquiry.
>
> As it turns out, the CFSCRIPT option is not viable because the
> point of the recursion was querying a database for records that
> represented subordinate records which might have subordinate
> records of their own.
>
> The cfmodule seems to take forever and therefore is not practical.
>
> In the end, I will have to change the design of the application.
> However, that is not necessarily a bad thing.  However, it does
> make me appreciate the changes in CFMX.
>
> Again, thank you all for your responses.
>
>
>
> -- Original Message --
> From: Mosh Teitelbaum <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date:  Thu, 12 Sep 2002 15:45:57 -0400
>
> >Or, you could rewrite the function without recursion.  Just thought I'd
> >mention it as another alternative.
> >
> >--
> >Mosh Teitelbaum
> >evoch, LLC
> >Tel: (301) 625-9191
> >Fax: (301) 933-3651
> >Email: [EMAIL PROTECTED]
> >WWW: http://www.evoch.com/
> >
> >
> >> -Original Message-
> >> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> >> Sent: Thursday, September 12, 2002 2:23 PM
> >> To: CF-Talk
> >> Subject: RE: Recursion
> >>
> >>
> >> > I wrote this really neat recursive function using the
> >> >  tag on my development system which is running
> >> > CFMX on WindowsXP Pro.  When I ported to the operational host
> >> > (third party), I discovered that they were running a previous
> >> > version of CF (I do not know which) which does not support
> >> > the new tag.  Does anybody know how to do recursion without
> >> > the  tag?
> >>
> >> If your recursive function is relatively simple, you can
> probably write it
> >> as a CF 5-compliant user-defined function, using CFSCRIPT.
> >> CFSCRIPT is a tag
> >> in which you can write CF commands using a JavaScript-like
> language, which
> >> uses the same syntax and control flow structures as
> JavaScript, but uses
> >> CFML operators and expressions. You can't use CFML tags within
> a CFSCRIPT
> >> tag, though, and CFSCRIPT doesn't support all the things you
> can do with
> >> CFML tags, such as querying a database. Keep in mind that the
> host would
> >> have to be using CF 5 or higher for this to work.
> >>
> >> Alternatively, you could write a recursive custom tag. However,
> >> this is the
> >> least desirable alternative, as custom tags don't provide any built-in
> >> ability to return values (you can write that ability into your
> >> code, though)
> >> and they tend to negatively affect performance. Nevertheless,
> if you need
> >> recursion and you're using a version of CF prior to 5, that's
> the only way
> >> you can do it within CFML.
> >>
> >> Dave Watts, CTO, Fig Leaf Software
> >> http://www.figleaf.com/
> >> voice: (202) 797-5496
> >> fax: (202) 797-5444
> >>
> >>
> >
> 
__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-12 Thread S . Isaac Dealey

Before you give up... There's a couple of things you can do for the
recursion in the db... One is to create a cross-reference table which shows
the parent-child relationship between all records in the table...
Alternatively, you could try this:








SELECT * FROM mytable
WHERE parentid IN (#valuelist(rs.id)#)

SELECT * FROM rs UNION SELECT * FROM rs2



This or something like it ought to give you a single query containing all of
the children of the parent... It will be much slower than a cross-reference
table in the db, however, it should be similar in performance to the current
solution... Once you have this query, however, you can then use the
recursive UDF in CF 5 and either pass the query to the UDF along with the
current parent id for the tree, or you can place the query in the request
scope and reference it from there...


hth

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> All,

> Thank you for your responses to my inquiry.

> As it turns out, the CFSCRIPT option is not viable because
> the point of the recursion was querying a database for
> records that represented subordinate records which might
> have subordinate records of their own.

> The cfmodule seems to take forever and therefore is not
> practical.

> In the end, I will have to change the design of the
> application.  However, that is not necessarily a bad
> thing.  However, it does make me appreciate the changes in
> CFMX.

> Again, thank you all for your responses.



> -- Original Message
> --
> From: Mosh Teitelbaum <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date:  Thu, 12 Sep 2002 15:45:57 -0400

>>Or, you could rewrite the function without recursion.
>>Just thought I'd
>>mention it as another alternative.
>>

>>--
>>Mosh Teitelbaum
>>evoch, LLC
>>Tel: (301) 625-9191
>>Fax: (301) 933-3651
>>Email: [EMAIL PROTECTED]
>>WWW: http://www.evoch.com/
>>
>>
>>> -Original Message-
>>> From: Dave Watts [mailto:[EMAIL PROTECTED]]
>>> Sent: Thursday, September 12, 2002 2:23 PM
>>> To: CF-Talk
>>> Subject: RE: Recursion
>>>
>>>
>>> > I wrote this really neat recursive function using the
>>> >  tag on my development system which is
>>> > running
>>> > CFMX on WindowsXP Pro.  When I ported to the
>>> > operational host
>>> > (third party), I discovered that they were running a
>>> > previous
>>> > version of CF (I do not know which) which does not
>>> > support
>>> > the new tag.  Does anybody know how to do recursion
>>> > without
>>> > the  tag?
>>>
>>> If your recursive function is relatively simple, you can
>>> probably write it
>>> as a CF 5-compliant user-defined function, using
>>> CFSCRIPT.
>>> CFSCRIPT is a tag
>>> in which you can write CF commands using a
>>> JavaScript-like language, which
>>> uses the same syntax and control flow structures as
>>> JavaScript, but uses
>>> CFML operators and expressions. You can't use CFML tags
>>> within a CFSCRIPT
>>> tag, though, and CFSCRIPT doesn't support all the things
>>> you can do with
>>> CFML tags, such as querying a database. Keep in mind
>>> that the host would
>>> have to be using CF 5 or higher for this to work.
>>>
>>> Alternatively, you could write a recursive custom tag.
>>> However,
>>> this is the
>>> least desirable alternative, as custom tags don't
>>> provide any built-in
>>> ability to return values (you can write that ability
>>> into your
>>> code, though)
>>> and they tend to negatively affect performance.
>>> Nevertheless, if you need
>>> recursion and you're using a version of CF prior to 5,
>>> that's the only way
>>> you can do it within CFML.
>>>
>>> Dave Watts, CTO, Fig Leaf Software
>>> http://www.figleaf.com/
>>> voice: (202) 797-5496
>>> fax: (202) 797-5444
>>>
>>>
>>
> __
> 
> Signup for the Fusion Authority news alert and keep up
> with the latest news in ColdFusion and related topics.
> http://www.fusionauthority.com/signup.cfm
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Archives:
> http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebar=lists



__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-12 Thread Robert Polickoski

All,

Thank you for your responses to my inquiry.

As it turns out, the CFSCRIPT option is not viable because the point of the recursion 
was querying a database for records that represented subordinate records which might 
have subordinate records of their own.

The cfmodule seems to take forever and therefore is not practical.

In the end, I will have to change the design of the application.  However, that is not 
necessarily a bad thing.  However, it does make me appreciate the changes in CFMX.

Again, thank you all for your responses.



-- Original Message --
From: Mosh Teitelbaum <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date:  Thu, 12 Sep 2002 15:45:57 -0400

>Or, you could rewrite the function without recursion.  Just thought I'd
>mention it as another alternative.
>
>--
>Mosh Teitelbaum
>evoch, LLC
>Tel: (301) 625-9191
>Fax: (301) 933-3651
>Email: [EMAIL PROTECTED]
>WWW: http://www.evoch.com/
>
>
>> -Original Message-
>> From: Dave Watts [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, September 12, 2002 2:23 PM
>> To: CF-Talk
>> Subject: RE: Recursion
>>
>>
>> > I wrote this really neat recursive function using the
>> >  tag on my development system which is running
>> > CFMX on WindowsXP Pro.  When I ported to the operational host
>> > (third party), I discovered that they were running a previous
>> > version of CF (I do not know which) which does not support
>> > the new tag.  Does anybody know how to do recursion without
>> > the  tag?
>>
>> If your recursive function is relatively simple, you can probably write it
>> as a CF 5-compliant user-defined function, using CFSCRIPT.
>> CFSCRIPT is a tag
>> in which you can write CF commands using a JavaScript-like language, which
>> uses the same syntax and control flow structures as JavaScript, but uses
>> CFML operators and expressions. You can't use CFML tags within a CFSCRIPT
>> tag, though, and CFSCRIPT doesn't support all the things you can do with
>> CFML tags, such as querying a database. Keep in mind that the host would
>> have to be using CF 5 or higher for this to work.
>>
>> Alternatively, you could write a recursive custom tag. However,
>> this is the
>> least desirable alternative, as custom tags don't provide any built-in
>> ability to return values (you can write that ability into your
>> code, though)
>> and they tend to negatively affect performance. Nevertheless, if you need
>> recursion and you're using a version of CF prior to 5, that's the only way
>> you can do it within CFML.
>>
>> Dave Watts, CTO, Fig Leaf Software
>> http://www.figleaf.com/
>> voice: (202) 797-5496
>> fax: (202) 797-5444
>>
>> 
>
__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-12 Thread Mosh Teitelbaum

Or, you could rewrite the function without recursion.  Just thought I'd
mention it as another alternative.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 625-9191
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/


> -Original Message-
> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 2:23 PM
> To: CF-Talk
> Subject: RE: Recursion
>
>
> > I wrote this really neat recursive function using the
> >  tag on my development system which is running
> > CFMX on WindowsXP Pro.  When I ported to the operational host
> > (third party), I discovered that they were running a previous
> > version of CF (I do not know which) which does not support
> > the new tag.  Does anybody know how to do recursion without
> > the  tag?
>
> If your recursive function is relatively simple, you can probably write it
> as a CF 5-compliant user-defined function, using CFSCRIPT.
> CFSCRIPT is a tag
> in which you can write CF commands using a JavaScript-like language, which
> uses the same syntax and control flow structures as JavaScript, but uses
> CFML operators and expressions. You can't use CFML tags within a CFSCRIPT
> tag, though, and CFSCRIPT doesn't support all the things you can do with
> CFML tags, such as querying a database. Keep in mind that the host would
> have to be using CF 5 or higher for this to work.
>
> Alternatively, you could write a recursive custom tag. However,
> this is the
> least desirable alternative, as custom tags don't provide any built-in
> ability to return values (you can write that ability into your
> code, though)
> and they tend to negatively affect performance. Nevertheless, if you need
> recursion and you're using a version of CF prior to 5, that's the only way
> you can do it within CFML.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
>
> 
__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion

2002-09-12 Thread Jeffry Houser

  Rewrite the function using the CFScript UDF syntax.  Theoretically it 
should work fine, but it may depend on what you are doing inside the 
CFFunction tag.

At 01:31 PM 9/13/2002 +0600, you wrote:
>Hello all,
>
>I wrote this really neat recursive function using the  tag on 
>my development system which is running CFMX on WindowsXP Pro.  When I 
>ported to the operational host (third party), I discovered that they were 
>running a previous version of CF (I do not know which) which does not 
>support the new tag.  Does anybody know how to do recursion without the 
> tag?
>
>Thank you!
>
>--
>Respectfully,
>
>Robert J. Polickoski, CNA
>Lead Programmer
>(540) 842-6339
>[EMAIL PROTECTED]
>AIM: RobertJFP
>Windows Messenger: RPolickoski
>--
>
__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion

2002-09-12 Thread Joe Eugene

UDF

- Original Message -
From: "Robert Polickoski" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, September 13, 2002 3:31 AM
Subject: Recursion


> Hello all,
>
> I wrote this really neat recursive function using the  tag on
my development system which is running CFMX on WindowsXP Pro.  When I ported
to the operational host (third party), I discovered that they were running a
previous version of CF (I do not know which) which does not support the new
tag.  Does anybody know how to do recursion without the  tag?
>
> Thank you!
>
> --
> Respectfully,
>
> Robert J. Polickoski, CNA
> Lead Programmer
> (540) 842-6339
> [EMAIL PROTECTED]
> AIM: RobertJFP
> Windows Messenger: RPolickoski
> --
> 
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion

2002-09-12 Thread Dave Watts

> I wrote this really neat recursive function using the 
>  tag on my development system which is running 
> CFMX on WindowsXP Pro.  When I ported to the operational host 
> (third party), I discovered that they were running a previous 
> version of CF (I do not know which) which does not support 
> the new tag.  Does anybody know how to do recursion without 
> the  tag?

If your recursive function is relatively simple, you can probably write it
as a CF 5-compliant user-defined function, using CFSCRIPT. CFSCRIPT is a tag
in which you can write CF commands using a JavaScript-like language, which
uses the same syntax and control flow structures as JavaScript, but uses
CFML operators and expressions. You can't use CFML tags within a CFSCRIPT
tag, though, and CFSCRIPT doesn't support all the things you can do with
CFML tags, such as querying a database. Keep in mind that the host would
have to be using CF 5 or higher for this to work.

Alternatively, you could write a recursive custom tag. However, this is the
least desirable alternative, as custom tags don't provide any built-in
ability to return values (you can write that ability into your code, though)
and they tend to negatively affect performance. Nevertheless, if you need
recursion and you're using a version of CF prior to 5, that's the only way
you can do it within CFML.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: recursion / parent-child relationships

2002-06-03 Thread Matt Robertson

A discussion on this went on just last week.  Check the archives.  Searching for 
''nested set'' should bring it up.

I wrote a freebie, ultra-basic cms that handles it in three different ways, depending 
on your resources.  Tear it up to see how it works.

http://makeashorterlink.com/?E19D21CF

One of those three methods uses cfx_fmaketree, also available free in the dev 
exchange, that makes short work of the whole business.

Those archives I mentioned should point to a non-cfx way to do the same thing as the 
cfx, created by this list's host.

Cheers,

---
Matt Robertson[EMAIL PROTECTED]
MSB Designs, Inc., www.mysecretbase.com
---


-- Original Message --
from: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
date: Mon, 3 Jun 2002 17:24:37 -0400

Hello-

I'm just starting to get into heirarchal data and I was wondering if anyone
could provide some insight into how to handle the looping and naming
conventions... Rather than re-invent the wheel.

Thanks in advance!

-Lou


__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion issue

2002-03-21 Thread Don Vawter

You may want to put a maximum number of steps in your recursion for testing
to make sure you havent gotten into a loop. You can always take it out later
when you are sure the function is well behaved.

°¿°
 ~
Don Vawter

- Original Message -
From: "Michael Corrigan" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 12:31 PM
Subject: Re: Recursion issue


> >From what I can tell yes.  It displays the information the way it is
supposed to and it appears that the browser stops 'thinking' and I can keep
working in the app, but a few minutes later it crashes.  Our administrator
is stumped.  I ran the function while he was watching the resource meter and
it looked like everything was fine.  I just wasn't sure if there was
something tricky with CF5 that I'm not aware of. I was told of a possible
memory leak with NT4 but we're properly patched so that doesn't appear to be
it.  I love using the recursive function because it's perfect for what I'm
doing (a series of parent child relationships).  I'm going to take a look at
the data and see if a parent and child are pointing to one another.  That
might screw things up.  I didn't think to handle that
> exception.
>
>
> Michael Corrigan
> Programmer
> Endora Digital Solutions
> 1900 Highland Avenue, Suite 200
> Lombard, IL 60148
> 630-627-5055 ext.-136
> 630/627-5255 Fax
>   - Original Message -
>   From: Christopher Olive
>   To: CF-Talk
>   Sent: Thursday, March 21, 2002 1:05 PM
>   Subject: RE: Recursion issue
>
>
>   is the exit condition being met correctly in the recursive function?
>
>   christopher olive
>   cto, vp of web development, vp it security
>   atnet solutions, inc.
>   410.931.4092
>   http://www.atnetsolutions.com
>
>
>   -Original Message-
>   From: Michael Corrigan [mailto:[EMAIL PROTECTED]]
>   Sent: Thursday, March 21, 2002 12:28 PM
>   To: CF-Talk
>   Subject: Recursion issue
>
>
>   We have an NT4 box with CF5 and I have a recursive function that appears
to run fine, but about five -ten minutes later, our system resources max out
and locks the server.  I can't find anything about this and was wondering if
anyone has had a similar problem?
>
>   Thanks,
>
>   Michael Corrigan
>   Programmer
>   Endora Digital Solutions
>   1900 Highland Avenue, Suite 200
>   Lombard, IL 60148
>   630-627-5055 ext.-136
>   630/627-5255 Fax
>
>
>
> 
__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion issue

2002-03-21 Thread Michael Corrigan

>From what I can tell yes.  It displays the information the way it is supposed to and 
>it appears that the browser stops 'thinking' and I can keep working in the app, but a 
>few minutes later it crashes.  Our administrator is stumped.  I ran the function 
>while he was watching the resource meter and it looked like everything was fine.  I 
>just wasn't sure if there was something tricky with CF5 that I'm not aware of. I was 
>told of a possible memory leak with NT4 but we're properly patched so that doesn't 
>appear to be it.  I love using the recursive function because it's perfect for what 
>I'm doing (a series of parent child relationships).  I'm going to take a look at the 
>data and see if a parent and child are pointing to one another.  That might screw 
>things up.  I didn't think to handle that 
exception.


Michael Corrigan
Programmer
Endora Digital Solutions
1900 Highland Avenue, Suite 200
Lombard, IL 60148
630-627-5055 ext.-136
630/627-5255 Fax
  - Original Message - 
  From: Christopher Olive 
  To: CF-Talk 
  Sent: Thursday, March 21, 2002 1:05 PM
  Subject: RE: Recursion issue


  is the exit condition being met correctly in the recursive function?

  christopher olive
  cto, vp of web development, vp it security
  atnet solutions, inc.
  410.931.4092
  http://www.atnetsolutions.com


  -Original Message-
  From: Michael Corrigan [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, March 21, 2002 12:28 PM
  To: CF-Talk
  Subject: Recursion issue


  We have an NT4 box with CF5 and I have a recursive function that appears to run 
fine, but about five -ten minutes later, our system resources max out and locks the 
server.  I can't find anything about this and was wondering if anyone has had a 
similar problem?

  Thanks,

  Michael Corrigan
  Programmer
  Endora Digital Solutions
  1900 Highland Avenue, Suite 200
  Lombard, IL 60148
  630-627-5055 ext.-136
  630/627-5255 Fax


  
__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion issue

2002-03-21 Thread Christopher Olive

is the exit condition being met correctly in the recursive function?

christopher olive
cto, vp of web development, vp it security
atnet solutions, inc.
410.931.4092
http://www.atnetsolutions.com


-Original Message-
From: Michael Corrigan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 12:28 PM
To: CF-Talk
Subject: Recursion issue


We have an NT4 box with CF5 and I have a recursive function that appears to run fine, 
but about five -ten minutes later, our system resources max out and locks the server.  
I can't find anything about this and was wondering if anyone has had a similar problem?

Thanks,

Michael Corrigan
Programmer
Endora Digital Solutions
1900 Highland Avenue, Suite 200
Lombard, IL 60148
630-627-5055 ext.-136
630/627-5255 Fax


__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Recursion of UDFs

2002-02-25 Thread Paul Wille

Actually, due to time, I'm going to have to bag on this idea for now.
I'll revisit soon, though.  I think the comment mentioned about the
local vars is my problem, though. :)  Such a simple little thing too!

Thank you anyway...I'll post an answer to it when I figure it out.

--PWW

Paul W. Wille[EMAIL PROTECTED]
--
Certified Advanced ColdFusion 5 Developer
--
ISITE Design, Inc. - Solutions Architect
www.isitedesign.com
503.221.9860 x110
888.269.9103
503.221.9865 fax
 


-Original Message-
From: Alex [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 25, 2002 2:41 PM
To: CF-Talk
Subject: Re: Recursion of UDFs

Lets see your UDF. maybe there is a bug.

On Mon, 25 Feb 2002, Paul Wille wrote:

> Hello everyone,
> 
> I have a flat table of employees (referenced by employee number) that
I
> need to build a dynamic Org chart for.  The necessary table
information
> is as such:
> 
> empNum   fName   lName   supervisorNum
> --
> 1JohnSmith   
> 2FredJones   1
> 3Frank   Johnson 2
> 
> 
> I need to represent this data in a struct, where child elements are a
> struct underneath the parent.  I am using a UDF that I recursively
call
> to populate this struct, but my UDF does not continue looping after
the
> first recursion call.  
> 
> Has anyone had this problem before?  Any help is certainly
appreciated.
> 
> Cheers,
> 
> --PWW
> 
> Paul W. Wille[EMAIL PROTECTED]
> --
> Certified Advanced ColdFusion 5 Developer
> --
> ISITE Design, Inc. - Solutions Architect
> www.isitedesign.com
> 503.221.9860 x110
> 888.269.9103
> 503.221.9865 fax
>  
> 
> 
> 

__
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion of UDFs

2002-02-25 Thread Alex

Lets see your UDF. maybe there is a bug.

On Mon, 25 Feb 2002, Paul Wille wrote:

> Hello everyone,
> 
> I have a flat table of employees (referenced by employee number) that I
> need to build a dynamic Org chart for.  The necessary table information
> is as such:
> 
> empNum   fName   lName   supervisorNum
> --
> 1JohnSmith   
> 2FredJones   1
> 3Frank   Johnson 2
> 
> 
> I need to represent this data in a struct, where child elements are a
> struct underneath the parent.  I am using a UDF that I recursively call
> to populate this struct, but my UDF does not continue looping after the
> first recursion call.  
> 
> Has anyone had this problem before?  Any help is certainly appreciated.
> 
> Cheers,
> 
> --PWW
> 
> Paul W. Wille[EMAIL PROTECTED]
> --
> Certified Advanced ColdFusion 5 Developer
> --
> ISITE Design, Inc. - Solutions Architect
> www.isitedesign.com
> 503.221.9860 x110
> 888.269.9103
> 503.221.9865 fax
>  
> 
> 
> 
__
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Recursion of UDFs

2002-02-25 Thread James Sleeman

At 11:33 AM 2/26/2002, you wrote:

>to populate this struct, but my UDF does not continue looping after the
>first recursion call.

Oh man, I spent most of yesterday debugging a seemingly simple recursive 
UDF, I was so sure it was all correct, just couldn't work out what was 
going on.  Until I finally realised, that I hadn't created my "local" 
variables as

 var localVariable = "";

but instead had just done

 localVariable = "";

causing, of course, localVariable to in fact be a global variable, so of 
course, my recursive calls were thoroughly munging what I thought were 
untouchable local variables, causing all manner of mayhem.

Oh for compiler warnings :-)



James Sleeman
Innovative Media Ltd
Phone: (03) 377 6262
http://www.websolutions.co.nz/

CAUTION: The information contained in this email message is confidential 
and may be legally privileged. If the reader of this message is not the 
intended recipient you are notified that any use, dissemination, 
distribution or reproduction of this message is prohibited. If you have 
received this message in error please notify the sender immediately and 
destroy the original message and any attachments.

Views expressed in this communication may not be those of Innovative Media Ltd. 
__
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists