Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: Need to get totals from certain rows.

$
0
0

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.

 

CaliforniaRoute 88: Alpine Co.SB-1992-CA-04$4,800.00
CaliforniaStatewide: Plan, Design, & Develop State ProgramSB-1992-CA-07$109,200.00
CaliforniaStatewide: Tourist InterpretationSB-1992-CA-06$120,000.00
ColoradoAlpine Loop: Hinsdale County Turnouts & ImprovementsSB-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!


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>