Solved

Coldfusion Code

Posted on 2008-06-25
3
157 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now