Instead of using <CFLOOP QUERY="x"> use <CFLOOP FROM="1"
TO="#x.RecordCount#" INDEX="i">. Then just make sure that you reference all
your vars as #x.FieldName[i]#. Or, you should be able to use the CurrentRow
variable from that first loop. EIther way will work, it just depends on
which you think you like better.
<CFQUERY DATASOURCE="#Application.DataSource#" NAME="x">
SELECT bug_id BugID, created_dt Created
FROM bugs_bugs
ORDER BY created_dt
</CFQUERY>
<!--- Method One --->
<CFLOOP QUERY="x">
<CFIF CurrentRow IS NOT RecordCount>
<CFSET NextID=CurrentRow+1>
<CFOUTPUT>Diff:
#DateDiff("d",Created,x.Created[NextID])#<BR></CFOUTPUT>
</CFIF>
</CFLOOP>
<CFOUTPUT><HR></CFOUTPUT>
<!--- Method Two --->
<CFSET NextToLast=x.RecordCount - 1>
<CFLOOP FROM="1" TO="#NextToLast#" INDEX="ThisID">
<CFSET NextID=ThisID+1>
<CFOUTPUT>Diff:
#DateDiff("d",x.Created[ThisID],x.Created[NextID])#<BR></CFOUTPUT>
</CFLOOP>
-Rick
-----Original Message-----
From: Tim Bahlke [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 05, 2000 2:53 PM
To: [EMAIL PROTECTED]
Subject: next row in <cfloop>
Hey all,
I am looping through a query and need to get data from the next row.
Make sense? While my loop in handling row 5, I need to grab some data from
row 6 and do a TimeFormat. I just can't seem to get to that next row.
I have tried a number of different ways to do this but have had no luck. It
seems that this screams for an embedded loop but I just can't seem to get
what I want.
If this makes any sense I anyone out there, I would be grateful for any
assistance.
Thanks,
Tim
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.