i just prefer that way of cflooping as i find it more flexible. e.g. can refer to previous or next rows by queryname.column[i-1]. hadn't thought of bunging it all in a cfscript, and i've no idea of the performance difference between this cfloop, the cfscript version or just using <cfloop query="queryname"> without any rows specified. maybe someone can do some tests and work it all out?
Duncan Cumming IT Manager http://www.alienationdesign.co.uk mailto:[EMAIL PROTECTED] Tel: 0141 575 9700 Fax: 0141 575 9600 Creative solutions in a technical world ---------------------------------------------------------------------- Get your domain names online from: http://www.alienationdomains.co.uk Reseller options available! ---------------------------------------------------------------------- ---------------------------------------------------------------------- "Stephen Moretti" To: <[EMAIL PROTECTED]> <stephen@cfmas cc: ter.co.uk> Subject: Re: [ cf-dev ] CFLOOP in CFMX 12/06/02 02:55 PM Please respond to dev Duncan, > > agreed. I tend not to use <cfloop query="foo">, but prefer <cfloop index > ="i" from="1" to="#queryname.recordcount#">. and if looping only 10 times, > or whatever less than the recordcount, then wrap it inside the check for > recordcount GT 0 > Is looping from 1 to recordcount more efficient than just looping the query from start to end without specifying the start/end rows?? I use the same code, but in CFSCRIPT for looping queries, but never using cfloop... So I'm curious if you find a performance difference with this. > incidentally, does <cfloop query="blah" startrow="1" endrow=" > #blah.recordcount#"> work (i.e. doesn't loop), or does it still loop at > least once? > As Tom says, it doesn't work in CFMX, but if you think about it if you have no records returned you're asking CF to do a loop from 1 to zero (a STEP of -1), so it should still try and do something, just that "something" isn't valid for a record set. Sridhar, > Because cfloop should take number of records first and then when it start > looping over it then it should take startrow attribute. > It shouldn't start the loop first from startrow attribute and then look for > records. > See above... You're asking CF to do a loop starting at row 1 and progressing to row zero.... Stephen -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
