A job can have multiple "time" entries associated with it. Each job/time combination is a record in the database.
The following code generates a row for every job returned from my query, and a column is generated for each "time" entry. This works just fine; all of my jobs and their times display.
I am trying to add a CFLOOP within the CFOUTPUT tags that will generate 7 columns, one for each day of the week. As I'm outputting the time for each job, I am making it display on the proper day of the week. It works fine for the first record returned, but I can't repeat the inner loop in subsequent iterations of the first output. (It displays multiple rows, with the job number listed, but it won't loop through and display their hours). The code is below.
I may just be confused on how loop and output work together. Any help is greatly appreciated.
Jennie
The following code generates a row for every job returned from my query, and a column is generated for each "time" entry. This works just fine; all of my jobs and their times display.
Code:
<cfoutput query="myQuery" group="job">
<tr>
<td>#job#</td>
<cfoutput>
<td>#time#</td>
</cfoutput>
</tr>
</cfoutput>
I am trying to add a CFLOOP within the CFOUTPUT tags that will generate 7 columns, one for each day of the week. As I'm outputting the time for each job, I am making it display on the proper day of the week. It works fine for the first record returned, but I can't repeat the inner loop in subsequent iterations of the first output. (It displays multiple rows, with the job number listed, but it won't loop through and display their hours). The code is below.
Code:
<cfoutput query="myQuery" group="job">
<tr>
<td>#job#</td>
<!--- print a cell for each day of the week --->
<cfloop index="countDays" from="1" to="7">
<td>
<!--- dayVar is a variable previously generated --->
<input type="Hidden" value="#DateFormat(DateAdd('WW', -1, dayVar), "mmddyy")#"></input>
<!--- if there was time worked for that day, print the hours --->
<cfoutput>
<cfif DateFormat(#date_worked#, "mmddyy") EQ DateFormat(DateAdd('WW', -1,#dayVar#), "mmddyy")>
#time#
</cfif>
</cfoutput>
<cfset dayVar = DateFormat(DateAdd('D', 1, dayVar), 'mm/dd/yy')>
</td>
</cfloop>
</tr>
</cfoutput>
I may just be confused on how loop and output work together. Any help is greatly appreciated.
Jennie