Totals in subreports and variable reset
Hi,
Using:
-------
Delphi 5, RB Enterprise 6.03
Description:
--------
We have master pipeline and a linked detail pipeline (1--0..n). The
master pipeline is linked to the main report, the detail pipeline is
linked to a subreport that is placed in the detail band of the main
report. We can only use RAP to calculate values.
Problem:
---------
We need to obtain the sum of a calculated value and display this in the
summary band of the detail report.
I have added a variable declaration in the subreport called
TotalWords : Integer
In a TppVariable in the detail band of the subreport I calculate a value
in the OnCalc event
eg
WordsEarned := ;
PointsEarned := ;
TotalWords := TotalWords + WordsEarned;
Value := PointsEarned
Another TppVariable placed in the summary banned has the following code
in the OnCalc event
Value := TotalWords
The problem is which event to use to set TotalWords to 0 (zero) again to
obtain the correct outcome. The value TotalWords needs to be reset every
time the master goes to the next record.
We have tried lots of possibilities but none really seem to work.
Furthermore the user can cange the settings from onepass to twopass or
back if they want this. Also we can't change versions of RB at the
moment, it is a legacy application.
Any ideas/suggestions are welcome
regards
Paul Sjoerdsma
Using:
-------
Delphi 5, RB Enterprise 6.03
Description:
--------
We have master pipeline and a linked detail pipeline (1--0..n). The
master pipeline is linked to the main report, the detail pipeline is
linked to a subreport that is placed in the detail band of the main
report. We can only use RAP to calculate values.
Problem:
---------
We need to obtain the sum of a calculated value and display this in the
summary band of the detail report.
I have added a variable declaration in the subreport called
TotalWords : Integer
In a TppVariable in the detail band of the subreport I calculate a value
in the OnCalc event
eg
WordsEarned := ;
PointsEarned := ;
TotalWords := TotalWords + WordsEarned;
Value := PointsEarned
Another TppVariable placed in the summary banned has the following code
in the OnCalc event
Value := TotalWords
The problem is which event to use to set TotalWords to 0 (zero) again to
obtain the correct outcome. The value TotalWords needs to be reset every
time the master goes to the next record.
We have tried lots of possibilities but none really seem to work.
Furthermore the user can cange the settings from onepass to twopass or
back if they want this. Also we can't change versions of RB at the
moment, it is a legacy application.
Any ideas/suggestions are welcome
regards
Paul Sjoerdsma
This discussion has been closed.
Comments
type TppVariable. Here is a RAP template using DBDemos data that shows a
running detail total across subreports in a subreport detail band and in the
main footer. Then in the detail summary, it shows the subreport's individual
running total. A variable in a subreport will automatically be reset when
the subreport end generation for a given master's detail band which parents
the subreport.
http://www.digital-metaphors.com/tips/RunningSubTotal.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com