Man... I see it in the docs online. I have never seen the for-in loop in the help section of cf studio - nor have I run into it elswhere. that could have saved me a lot of counter code <g>. Live and learn.
-mk -----Original Message----- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Monday, July 15, 2002 2:08 PM To: CF-Talk Subject: RE: cfscript for in vs cfloop collection... Incorrect. for(x in foo) normally works just fine. <cfscript> x = structNew(); x.alpha = "ray"; x.gamma = "camden"; for(i in x) { writeOutput("key=#i#, val is #x[i]#<br>"); } </cfscript> ======================================================================= Raymond Camden, ColdFusion Jedi Master for Macromedia Email : [EMAIL PROTECTED] Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda > -----Original Message----- > From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 4:00 PM > To: CF-Talk > Subject: RE: cfscript for in vs cfloop collection... > > > Yep... the for loop expects a counter (for (i = 1; i le > Len(somevar); i = i > + 1) ) There is no "in" key word for it. sorry. You will have to > + determine > the number of childnodes in /trackresponse/activity and use > that as your counter. > > mark > > -----Original Message----- > From: Jon Hall [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 2:56 PM > To: CF-Talk > Subject: cfscript for in vs cfloop collection... > > > Perhaps someone else can see what I am doing wrong here > (cf5). I've had this problem in the past, and just included > the code inline with a cfloop around my cfscript, but now I > want to convert the code to a UDF... Here is the code. > > This works fine: > <cfloop collection="#transDOM.selectNodes("/TrackResponse/Activity")#" > item="i"> > > This throws an invalid parser construct error at the second > parentheses (yes I have tried both single and double quotes): > for ( i in objXMLDOM.selectNodes('/TrackResponse/Activity')) { > > Am I wrong in assuming that cfloop-collection and cfscript > for-in loops are the same? > > jon > > > ______________________________________________________________________ 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/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

