Hey all,
I am writing a bit of code that is suppose to do this:
Check for a value in the database within a certain time period.
If there is no value in this time period, then check previous months
until there is a value.
It sounds so simple.
I tried using a conditional loop to accomplish it.
<CFSET counter = -1><!---
Initialise the counter to -1 to Search the previous month --->
<CFSET MileageLast = 0>
<!--- Grab Mileage from Previous
Month --->
<CFLOOP condition="MileageLast
LTE 0">
<CFQUERY
name="GetVehicleMileageLast" datasource="relora" DBTYPE="Oracle80" >
SELECT Mileage
FROM TblVmile
WHERE RecordDate
>=
to_date('#DateFormat(DateAdd('m',counter,Searchdate),'mm/dd/yyyy')#','mm
/dd/yyyy')
AND RecordDate
<=
to_date('#DateFormat(DateAdd('d',(DaysInMonth(DateAdd('m',counter,Search
date))-1),
DateAdd('m',counter,Searchdate)),'mm/dd/yyyy')#','mm/dd/yyyy')
AND Vehicle_NBR
= #GetTeamVehicles.Vehicle_NBR#
</CFQUERY>
<CFSET MileageLast =
GetVehicleMileageLast.Mileage>
<CFSET Counter = Counter -1>
</CFLOOP>
It doesn't work. The CFServer and Oracle shoot to about 100% usage
between themselves, and I never see any output.
I figure my logic is loopy.
Can anyone tell me what I'm doing wrong? :)
-Gel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com