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