You can pass values from the subreport into the main report by storing the value in a shared variable, and calling the shared variable in the main report.
There is a lot of shared variable information in your online help in Crystal Reports.
Essentially, you will be creating one formula in your subreport, like:
//@Populate The Variable
WhilePrintingRecords;
Shared NumberVar XXX := {YourField};
and another one in your main report - which is placed in a section after your subreport:
//@Call The Variable
WhilePrintingRecords;
Shared NumberVar XXX;
If you want to accumulate the value of the variable in the main report so that you can get a grand total going, then you would use a formula like this one:
//@Add Up Each Occurence Of The Variable
WhilePrintingRecords;
NumberVar YYY;
Shared NumberVar XXX;
YYY := YYY + XXX;
You would have to place a formula like the last one in a B section of wherever the subreport is placed. For example, if the subreport is situated in Group Footer 1a, then you place the formula in Group Footer 1b.
Thanks, this work but I have to redesign my report then, because I have the summary field and the subreport in the same section. Or is it another way to do it?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.