Need to Add totals

Need to Add totals

Forum member · Mar 1, 2006
Hi All, Using: Community PDF Generator, VS 2005, C#, MS SQL 2005, ASP-Web app I've got a bunch of simple reports done. Now I need to do a report with a grand-total line at the bottom. Not sure how to go about this. Also, how would you do a report that needs to break on groups and do sub-totals and then a grand-total. Any sample code appreciated. Thanks, Joe

Re: Need to Add totals

Support · Mar 1, 2006
Hello Joe, To accomplish this you would need to keep a counter and increment it with the value in the column you wish to get the total of, every time you add a record. When you are finished you would then have the total for the integer column which you can display it at the end. In order to break your reports into groups, you will have to use "Group By" clause in your query and then display the results and then using the above mentioned method calculate sub-totals and then add up all the sub-totals to get the grand total. Thanks, ceTe Software Support Team

Re: Need to Add totals

Forum member · Mar 2, 2006
Yes, I had started to code a solution along these lines. I was hoping there would be a more easy/automatic way of doing this. Funny, I was coding reports like this back when I was using dBase/Clipper many years ago. As they say the more things change the more they stay the same. Thanks, Joe