Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summarizing in the main report of a field in a subreport 2

Status
Not open for further replies.

sfunk

Technical User
Jan 22, 2002
107
US
Hello,

I have a report that has a subreport in the Detail section. I need to summarize a field from the subreport in the main report. Is this possible? If so, can you get me pointed in the correct direction?

Sincerely,
Steve
 
You will need to use a shared variable to pass values back and forth between the subreport and the main report.

In the subreport:

WhilePrintingRecords;
Shared NumberVar ABC:=<<value or expression>>

In the main report
WhilePrintingRecords;
Shared NumberVar ABC

Or you can manipulate the subreport value after it get to the main report. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
The Shared Variable will need to be placed in either the same section as the subreport or any section below the subreport in order to return a value;-)
 
Thank you. My question is now, how do I clear the shared variable for the next record?

Thanks,
Steve
 
Nevermind on that question I figured it out.

But,

It doesn't carry the value over in the detail section (which is where the subreport is). It does work in the group footer though. How can I get the value to work in the main report/detail section? I assume I need to change the &quot;WhilePrintingRecords&quot; to something else?

Sincerly,
Steve
 
Keep the WhilePrintingRecords;

Fact is, the value won't be returned from the subreport until after the subreport has finished processing.

Naith
 
OK, does that mean that there is not a way to display the value in the detail section? Is there a way to force the display of the variable in the main report to wait for the subreport to have completed running?

Thanks,
Steve
 
If you place the shared variable in any section of the main report after the section where the subreport is being processed, then the variable won't have any choice but to wait for the subreport to finish processing before it's displayed.

Naith
 
OK. Thanks.

I have that working now. For some reason I can't run a summary on the formula eventhough I used a NumberVar. What can I do in the formula to make it a number so I can use it in a rollup.
Formula:
WhilePrintingRecords;
Shared NumberVar JTT_for_Rollup

 
What's a rollup? A sum total? Sorry if that's a superfluous question, but I'm guessing it's an Americanism that hasn't hit the shores of England yet... like 'squirl'.

If you can't do an automated sum on your shared variable, you can total it up via another variable.

WhilePrintingRecords;
Shared NumberVar JTT_for_Rollup;
NumberVar JTT_Total := JTT_Total + JTT_for_Rollup;

Naith
 
Sorry about the slang term.

Thank you very much that worked great.

Cheers,
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top