Try adding <CFSET CurrentEmpID = getEmployees.Employee_ID> before the
second
CFQUERY and use this variable in your 2nd query.
See Below.
********************************************************************
<CFQUERY name="GetEmployees" datasource="xxxxx"
DBTYPE="ORacle80">
Select Employee_ID FROM Empl_General
</CFQUERY>
<CFOUTPUT query="GetEmployees">
<CFLOOP CONDITION="#CurrentDate# LESS THAN OR EQUAL TO #EndDate#">
<CFSET CurrentEmpID = GetEmployees.Employee_ID>
<CFSET CurrentDate = DateFormat(#CurrentDate#,'mm/dd/yyyy')>
<CFQUERY name="GetHours" datasource="xxxx"
DBTYPE="Oracle80">
Select SUM(RegHrs) AS TotalHours FROM
TblMainEntry,TblDetailEntry
WHERE TblMainEntry.EmpID=
#CurrentEmpID#
AND tblDetailEntry.RecordDate=
to_date('#currentdate#','mm/dd/yyyy')
AND tblMainEntry.MainID = TblDetailEntry.MainID
</CFQUERY>
<CFIF GetHours.TotalHours GT 24>
#GetHours.Employee_ID#   
#GetHours.TotalHours#
</CFIF>
<CFSET CurrentDate = DateAdd("d",CurrentDate,1)>
</CFLOOP>
</CFOUTPUT>
-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2002 15:02
To: CF-Talk
Subject: Problems with looping
Hey all!
Take a look at this code.
The idea of course, is to loop through all the employees in the table
and run a particular query against each employee.
_______________________________________________________
<CFQUERY name="GetEmployees" datasource="xxxxx"
DBTYPE="ORacle80">
Select Employee_ID FROM Empl_General
</CFQUERY>
<CFOUTPUT query="GetEmployees">
<CFLOOP CONDITION="#CurrentDate# LESS THAN OR EQUAL TO
#EndDate#">
<CFSET CurrentDate=
DateFormat(#CurrentDate#,'mm/dd/yyyy')>
<CFQUERY name="GetHours" datasource="xxxx"
DBTYPE="Oracle80">
Select SUM(RegHrs) AS TotalHours FROM
TblMainEntry,TblDetailEntry
WHERE TblMainEntry.EmpID=
#GetEmployees.Employee_ID#
AND tblDetailEntry.RecordDate=
to_date('#currentdate#','mm/dd/yyyy')
AND tblMainEntry.MainID = TblDetailEntry.MainID
</CFQUERY>
<CFIF GetHours.TotalHours GT 24>
#GetHours.Employee_ID#    #GetHours.TotalHours#
</CFIF>
<CFSET CurrentDate = DateAdd("d",CurrentDate,1)>
</CFLOOP>
</CFOUTPUT>
_______________________________________________-
However, it picks up the first employee, runs through the SQL
statements
etc. and then never goes onto the second.
Any idea why this is happening?
I must be missing something really simple, but I can't figure out what.
-Angel
______________________________________________________________________
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists