Site Search:
Sign in | Join | Help
4Penny.net

Crystal Reports

Notes, Tips and Tricks on Developing using Crystal Reports

Running totals in Crystal Reports, the hard way

I happens that I need to do a running total in a report, and I can't use the built in 'running total' feature for some reason or another. (the current issue is that I need a running total on a formula field that exists only in a group footer)

The code to do the deed is kind of a pain, but here it is.

 Create a formula called @reset, like this:
WhilePrintingRecords;
    numbervar total := 0;

Place this in the Report Header section

Create a formula called @calc, like this:
WhilePrintingRecords;
    numbervar total;
    total := total + {@myfieldname};

Place this in the Group Footer (in my case)

Create a formula called @print, like this:
WhilePrintingRecords;
    numbervar total;
    total := total ;

Place this in the Report Footer.

@reset is always invisible, and @calc is usually invisible. I mainly only us @print

 

As always, your comments are welcome

Comments

 

janak said:

very bad programming

August 18, 2007 4:37 AM
 

sajid said:

i want to runningtotal in header of the report page

in crystalreport

August 18, 2007 4:40 AM
 

Learnvbnet said:

Great job. I wasted 1 day trying to do that. Kind of really relieved that it's working now

October 17, 2007 9:08 AM
 

Su said:

Good.Thanks

July 18, 2008 3:25 AM
 

azam said:

Create a formula called @calc, like this:

WhilePrintingRecords;

   numbervar total;

   total := total + {@myfieldname};

Replace all above formula with this only it works same as above

July 30, 2008 1:06 AM
 

Karanjeet Singh said:

Great! It worked out for me. Thanks

August 5, 2008 12:29 AM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.