Totalling a field from a sub-report to its master report.
Hello,
Using ReportBuilder 7 with Delphi 7.
I'm trying to get an average of a field in a pipeline on a sub-report - the
average must appear on the main report. Practically, the sub report is 4 or
5 detail levels down from the main report. How do i do this?
Regards
Gilbert
Using ReportBuilder 7 with Delphi 7.
I'm trying to get an average of a field in a pipeline on a sub-report - the
average must appear on the main report. Practically, the sub report is 4 or
5 detail levels down from the main report. How do i do this?
Regards
Gilbert
This discussion has been closed.
Comments
the data pipeline of the detail report, but this seems to go awry when the
set of records crosses a page, so am still confused.
The basic approach is to use the subreport to update a TppVariable that
resides in the main report. If you are using RAP code to implement this,
then you need to create global var in RAP that provides a reference to the
main reports TppVariable.
Example:
Use the RAP Module view to declare a global var....
gMainVar: TppVariable;
Use the RAP global OnCreate to intialize the reference
gMainVar := ppVarMain;
Then in the subreport you can use gMainVar.
For future reference, please note:
If you are trying to do this in RAP code, then the question should be posted
to the RAP newsgroup. Otherwise, it should be posted to the SubReports
newsgroup.
The End-User is appropriate for questions related to building an end-user
solution. In other words, question abou the end-user designer, report
explorer, data dictionary, etc.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I tried your suggestion, and it worked as long as the calculating variable
was on the main report. After a few hours of playing, the only [twisted] way
i could get it right was:
I dropped a TppVariable on the main report that traversed the pipeline where
my values are (5 levels down).
Then i created a global variable that points to the place where the sum is
to appear (sub-report 1 level down - using that sub-report's OnCreate)
In the OnCalc of the main report variable, i sum the actual values straight
from the detail pipeline and use the global pointer to populate the display
variable.
To reset the main variable appropriately (i.e. in the display sub-report), i
had to create a further global that points to the main report variable and
set its value to zero in the appropriate OnGroupBreak on the display
sub-report.
Using your approach straight on the sub-report caused calculation problems
when multiple pages were involved.
I have now bought RB9 in the hope that i will be able to understand the
event-firing / pagination method that is used.
Regards,
Gilbert
I just recalled that there is a TppVariable patch available for RB 9.02 that
contains a fix for an issue related to having a Variable incremented by a
subreport.
Send an email to support@digital-metaphors.com and request the TppVariable
patch for RB 9.02.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
it.