This topic is locked

Column Total

3/7/2004 1:49:54 PM
ASPRunnerPro General questions
I
isdntest author

HI...
Great product.
Is there a way to get a column sum ? I have a database where I frequently looking at the cost of different elements from a montlhy bill. I have the costs for each element - but a sum would be nice depending on the query I make.
I am also wondering if someone can point me to directions on:

  • how to format dates
  • different formats for currency
    Thanks in advance,
    Charlie

Sergey Kornilov admin 3/10/2004

You can modify Sub LoopRs in ..._list.asp for this purpose. See my changes in bold.

' display table with results

sub loopRs(rsData,nPageSize)
Total1=0

Total2=0


' Pagination:

dim iShadeTheDetail

dim iNumberOfRows

iNumberOfRows = 0

if isObject(rsData) then

 ' Pagination: UNTIL iNumberOfRows>=maxrecs

 DO UNTIL rsData.eof OR iNumberOfRows>=nPageSize
   Total1 = Total1 + rsData("Field1")

   Total2 = Total2 + rsData("Field2")

...
 Loop

Â

Â

response.write "<tr class=blackshade><td class=blackshade>" & Total1 & "</td><td>" & Total2 & "</td></tr>"
end if

end sub


To find more about date/time and currency formats check the following URLs
FormatCurrency
FormatDateTime

C
craigcjr 3/10/2004

Great info, ASPRunner best money I've spent for my business.
Kinda along the same lines, I have a table with over 10,000 tickets and adds about 800 more each day, so its always changing. Is it possible to add a <tr> at the top of my list, that would allow a count of certain amout of records in th table. In other words when I bring up a list, it show a totals of 4 different type of tickets on the top over the list. My next thing would to be have a hyper link to just those ticket types. Boy that was a mouth full. Thanks in advance.
Craig

C
craigcjr 3/13/2004

Got my counts done, everything works great, what a great program........