Solved

Coldfusion Code

Posted on 2008-06-25
3
164 Views
Last Modified: 2013-12-24
The code below will display the job number and employee number and the hours on each job, however, if each employee has many jobs then the employee will appear in its row for each job which is fine. I do not want the hours worked to turn up after each job tho, I want a total amount of hours to turn up for each job  in a new column. How can this be done?
<td><cfloop index="ind" from="1" to="#get_fsr.recordcount#" step="1">
#get_FSR.FSR_JobNumber[ind]# - #get_fsr.FSR_EmployeeNumber[ind]# - <br>Worked Hours:#get_fsr.FSR_Work_Time[ind]#
<br>
<cfif ind is not get_fsr.recordcount>
<br>
</cfif>
</cfloop>

Open in new window

0
Comment
Question by:xrayroom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 18

Expert Comment

by:Plucka
ID: 21864183
Just store a reference to last code

then say if this code neq last code display total.
0
 

Author Comment

by:xrayroom
ID: 21864323
how could I  write the for this?
0
 
LVL 2

Accepted Solution

by:
dbanttari earned 250 total points
ID: 21865415
Actually, a grouped CFOUTPUT makes this easy:

<table>
<tr>
	<th>Job</th>
	<th>Employees</th>
	<th>Total</th>
</tr>
<cfoutput query="get_fsr" group="FSR_JobNumber">
<tr>
	<td valign="top">
		#get_FSR.FSR_JobNumber#
	</td>
	<td>
		<cfset hours=0>
		<cfoutput>
			#get_fsr.FSR_EmployeeNumber#<br>
			<cfset hours = hours + FSR_Work_Time>
		</cfoutput>
	</td>
	<td valign="top">
		Worked Hours:#hours#
	</td>
</tr>
</cfoutput>
</table>

Open in new window

0

Featured Post

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question