Can someone tell me why this code is not displaying the "time" field in the table? I cannot figure it out.

<tr>

<CFQUERY NAME="getAllTechsWeeklyActivity" DATASOURCE="VEHSALES">							
SELECT date, time, DatePart(ww, date), datepart(dw, date) AS weekday
FROM service_tech_activity 
WHERE DatePart(ww, date) = DatePart(ww, '#DateFormat("#editdate#", "yyyy-mmm-dd")#')
AND DatePart(yyyy, date) = DatePart(yyyy, '#DateFormat("#editdate#", "yyyy-mmm-dd")#')
GROUP BY date, time, DatePart(ww, date), datepart(dw, date)
</CFQUERY>        				
  
  <CFSET sunday = 0>
  <CFSET monday = 0>
  <CFSET tuesday= 0>
  <CFSET wednesday = 0>
  <CFSET thursday = 0>
  <CFSET friday = 0>
  <CFSET saturday = 0>
  <CFSET total = 0>    
                       
<CFLOOP QUERY="getAllTechsWeeklyActivity">
<cfif #weekday# is 1>					
<cfset sunday = #DecimalFormat(time)#>						
<cfelseif #weekday# is 2>		                                
<cfset monday = #DecimalFormat(time)#>          
<cfelseif #weekday# is 3>					
<cfset tuesday = #DecimalFormat(time)#>						
<cfelseif #weekday# is 4>					
<cfset wednesday = #DecimalFormat(time)#>						
<cfelseif #weekday# is 5>
<cfset thursday = #DecimalFormat(time)#>						
<cfelseif #weekday# is 6>
<cfset friday = #DecimalFormat(time)#>						
<cfelseif #weekday# is 7>
<cfset saturday = #DecimalFormat(time)#>						
</cfif>
<cfset total = DecimalFormat(total + #time#)>
</CFLOOP>
			  			  
<td align="center" valign="top" width="10%" bgcolor="#61676B" class="tabletext"><STRONG>#monday#</STRONG></td>				
<td align="center" valign="top" width="10%" bgcolor="#61676B" class="tabletext"><STRONG>#tuesday#</STRONG></td>				
<td align="center" valign="top" width="10%" bgcolor="#61676B" class="tabletext"><STRONG>#monday#</STRONG></td>				
<td align="center" valign="top" width="10%" bgcolor="#61676B" class="tabletext"><STRONG>#wedneday#</STRONG></td>				
<td align="center" valign="top" width="10%" bgcolor="#61676B" class="tabletext"><STRONG>#friday#</STRONG></td>				
<td align="center" valign="top" width="10%" bgcolor="#61676B" class="tabletext"><STRONG>#saturday#</STRONG></td>				
<td align="center" valign="top" width="15%" bgcolor="#61676B" class="tabletext"><strong>#total#</strong></td>
						        
</tr>

Recommended Answers

All 2 Replies

Basically, at the end of the code snippet where #monday#, #tuesday#, etc. is displayed - it isnt displaying the "time" value coming back from the database. I am not sure what I am missing.

Thanks,

No offense but that query is terribly inefficient. Yes, you can do this the long way (with CF code). But most db's have far more efficient ways to calculate sums for a set of 7 values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.