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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting up main variables to recieve values from subreports

Status
Not open for further replies.

haywardkl

MIS
Aug 8, 2002
1
US
I am a new Crystal Reports programmer and I am having problems getting data from my sub report back to my main report.

I have my sub report linked to my main report and it works perfectly. What I need to do is total my records from the sub report so I want to send back a total on each record then do a subtotal on each group.

My tables are a left outer Main to Sub and the linked key is the call id.

----- main rpt ------- ------- sub rpt -------
ie. 1000 name 29 days customer support QR
customer support QR
inventory control
inventory control
1001 name 25 days customer support QR
Admin function

Totals Customer support QR 3
inventory control 2
admin function 1

what do my variables in the main report need to contain to have in them accept the values (not displaying) from the sub report.

Thanks for your help
Karen
 
In your sub set your variable:

whileprintingrecords;
shared numbervar TotalFromSub:= sum(x)

in main report

whileprintingrecords;
numbervar GrandTotal:= GrandTotal + shared numbervar TotalFromSub



make sure this is in a section following where the sub is called
 
I think that you'll want the 3 formula approach:

In the Main report group header before the subreport is ran (you can use right click insert group if the sub is ran at the group level to create seperate group sections for the formula and subreport), reset the value:

whileprintingrecords;
shared numbervar TheValue:= 0;

In the SubReport:

whileprintingrecords;
shared numbervar TheValue := sum({trable.value]);

In the Main report group footer use:

whileprintingrecords;
shared numbervar TheValue

to display or use the value in other formulas.

-k

 
Thanks!!!


That was the exact info that I was looking for (the 3 formula approach)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top