The code below works, except for one thing...passing
the year value via DatePart. If I remove that, and
put a year, like 1999 or 2000, the whole cfswitch
works and does what it is supposed to. But it won't
read the date from DatePart, it goes to the
cfdefaultcase. I also tried
YEAR(qGetTimes.cert_issue_date), but that did not work
either.
<cfset Year99Total = 0>
<cfset Year00Total = 0>
<cfset Year01Total = 0>
<cfloop query="qGetTimes">
<cfswitch expression = DatePart("yyyy",
qGetTimes.cert_issue_date)>
<cfcase value = "1999">
<cfset Year99Total = Year99Total +
#qGetTimes.time_to_refer#>
</cfcase>
<cfcase value="2000">
<cfset Year00Total = Year00Total +
#qGetTimes.time_to_refer#>
</cfcase>
<cfcase value="2001">
<cfset Year01Total = Year01Total +
#qGetTimes.time_to_refer#>
</cfcase>
<cfdefaultcase>
<cfoutput>No work done</cfoutput>
<cfabort>
</cfdefaultcase>
</cfswitch>
</cfloop>
<cfset Year99Avg = Year99Total / 12>
<cfset Year00Avg = Year00Total / 12>
<cfset Year01Avg = Year01Total / Month(Now())>
Any ideas on how to pass the year values into the
cfswitch? Is there an easier way I should be doing this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists