That works, but it has the same problem that my attempt had. It puts the total for the state after the first occurence of the next state.
i.e.
California | Route 88: Alpine Co. | SB-1992-CA-04 | $4,800.00 |
California | Statewide: Plan, Design, & Develop State Program | SB-1992-CA-07 | $109,200.00 |
California | Statewide: Tourist Interpretation | SB-1992-CA-06 | $120,000.00 |
Colorado | Alpine Loop: Hinsdale County Turnouts & Improvements | SB-1992-CO-06 | $96,136.00 |
$736,400.00 |
But I was able to tweak it to get this:
<cfoutput query="by_year" group="proj_year">
<h2>#proj_year#</h2>
<table class="datatable pc100">
<tr>
<th scope="col" width="12%">State</th>
<th scope="col">Name</th>
<th scope="col">Project##</th>
<th scope="col" width="12%">Funding Amount</th>
</tr>
<cfset prev_name = "">
<cfoutput>
<cfset curr_name = name />
<cfif NOT ( (prev_name EQ "") OR (prev_name EQ curr_name) )>
<!--- display total --->
<tr>
<td align="right" colspan="4">#LSCurrencyFormat(total,"local")#</td>
</tr>
<!--- reset total --->
<cfset total = 0 />
</cfif>
<tr>
<td scope="row">#htmleditformat(name)#</td>
<td>#htmleditformat(proj_name)#</td>
<td>#htmleditformat(project_no)#</td>
<td align="right">#LSCurrencyFormat(funding_amt,"local")#</td>
</tr>
<cfset total = total + funding_amt />
<cfset prev_name = curr_name />
</cfoutput>
</table>
</cfoutput>
Which works quite well.
Thanks for the help! I was quite stuck!