“How do I keep a running total of the previous page(s) in the header band of the current page being viewed?”
Place a TppVariable inside the footer band of the report to keep track of the running total until that point. Then assign that value to a TppVariable located inside the header band of the report.
When a report is printing, each detail band is generated until space on the page runs out. Once this happens, the engine backs up and prints the last detail band first on the next page. This detail band however has already been calculated and data traversed causing calculations made on traversal (based on the page) to be one record off. Using the footer band to keep track of the current page’s totals solves the problem.
Sample Delphi/RAP code:
//ppVariable1 is located in the Header Band.
//ppVariable2 is located in the Footer Band and is connected to the event below.
procedure TForm1.ppVariable2Calc(Sender: TObject; var Value: Variant);
Value := Value + ppReport1.DataPipeline['AmountPaid'];
ppVariable1.Value := ppVariable2.Value;