I have a problem calculating the average. What i need is if the query does not
return returns a record then do not increase the counter (this part is working)
Also if the query.hours eq 0 and query.minutes eq 0 also should not increase
the counter
<cfset empCnt2=0>
<cfset empCnt=0>
<cfset scoreCnt=0>
<cfset tAvg=0>
<cfset scoreCnt2=0>
<cfset tAvg2=0>
<cfloop query="getAvg">
<cfquery name="getTimeAvg1" datasource="cfelsunrise"
dbtype="ODBC">
select hours,minutes from TimesOnline where empID=#EID#
and coursename like 'Activity Programming%'
</cfquery>
<cfif getTimeAvg1.recordcount gt 0>
<cfset Hours = getTimeAvg1.hours>
<Cfset minutes=getTimeAvg1.minutes>
<cfset Hours2=Hours*60>
<cfset Hours1=Hours2+minutes>
<cfset scoreCnt=scoreCnt+Hours1>
<cfset empCnt=empCnt+1>
</cfif>
<cfset tAvg=scoreCnt/empCnt>
<td align="center"><cfoutput>#Round(tAvg)#</cfoutput></td>
Please help
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306374
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4