I think I'm approaching this from the wrong angle. I think I'd be better served if I put my effort into the SQL Server Reporting Service.
Have you or anyone here used it?
I can fumble through most of it, but I'm having a hard time getting it to perform some math and getting it to let me select what I want from the database.
Think I'm going to buy a book about it.
The point is not to show YOUR power (which frankly, there is none, but I'm not telling), but THEIR abject helplessness (of which there is a copious, abundant and boundless supply, until the end of time, oh lord).
The easiest way to do that is to go out and get smashed, then show up for work the next day. Enjoy.
Pete - These numbers are what I get if I query a table in my db. How can I add ONLY the positive numbers and ignore the negatives?
-114.68
79.50
-8.48
2221.93
3994.88
-142.04
2655.45
-157.36
1084.00
-108.40
986.85
-58.48
15258.80
OK I'm having a hell of a time getting the summing to work, do you think you can assist?
I've attached the code and the output thus far.
Thanks!
<table cellpadding="2" align="center"> <tr> <td align="center"><font face="arial" size="4"><b>Kiln Number</b></font></td> <td align="center"><font face="arial" size="4"><b>Batch Date</b></font></td> <td align="center"><font face="arial" size="4"><b>Species</b></font></td> <td align="center"><font face="arial" size="4"><b>Footage In</b></font></td> <td align="center"><font face="arial" size="4"><b>Value In</b></font></td> <td align="center"><font face="arial" size="4"><b>Footage Out</b></font></td> <td align="center"><font face="arial" size="4"><b>Value Out</b></font></td> <td align="center"><font face="arial" size="4"><b>Variance</b></font></td> <td align="center"><font face="arial" size="4"><b>Absorption</b></font></td> <td align="center"><font face="arial" size="4"><b>MFG Variance</b></font></td> </tr> <!--- Loop the output and display it ---> <CFOUTPUT QUERY="kilns"> <cfset intotal = 0> <cfif rudTotal GT 0> <cfset intotal = intotal + rudTotal> </cfif> <!--- Set values in our variables ---> <TR> <td align="center"><font face="arial" size="4">#ruhID#</TD> <td align="center"><font face="arial" size="4">#DateFormat(ruhDate, "MM/DD/YYYY")#</TD> <td align="center"><font face="arial" size="4">#MID(rudProductID,6,2)#</TD> <td align="center"><font face="arial" size="4">#NumberFormat(ConsumedVol, ",")#</TD> <td align="center"><font face="arial" size="4">#intotal#</td> <td align="center"><font face="arial" size="4">#NumberFormat(ProducedVol, ",")#</TD> </TR> </CFOUTPUT> </TABLE>
CFOUTPUT QUERY="kilns" GROUP="ruhID"> <cfset intotal = 0> <cfif rudTotal GT 0> <cfset intotal = intotal + rudTotal> <cfset Total_Value_In = Total_Value_In + intotal> </cfif>
<cfquery name="KilnsById" dbtype="query"> SELECT * FROM Kilns ORDER BY ruhId ASC </cfquery> <cfset TotalTotal = 0 /> <cfoutput query="KilnsById" group="ruhId"> <cfset InTotal = 0 /> <cfoutput> <cfset InTotal += rudTotal /> </cfoutput> <cfset TotalTotal += InTotal /> </cfloop>
<cfquery name="KilnsById" dbtype="query"> SELECT * FROM Kilns ORDER BY ruhId ASC </cfquery> <cfset TotalTotal = 0 /> <cfset InTotal = [] /> <cfoutput query="KilnsById" group="ruhId"> <cfset InTotal[ruhId] = 0 /> <cfoutput> <cfset InTotal[ruhId] += rudTotal /> </cfoutput> <cfset TotalTotal += InTotal[ruhId] /> </cfloop>