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

Totalling a shared sub-report variable in the main report

Status
Not open for further replies.

maxitaxi

Technical User
Oct 11, 2010
3
AU
Hi all,

I would like to total a shared sub-report variable in my main report, however the main report does not seem to let me summarise it (or perform a running total on it), ie, it is not selectable.

Due to the database design, i have a sub-report in detail A with this formula {sub_kg}:
WhilePrintingRecords;
Shared numbervar kg;
kg:={table.weight}

Main report has this formula in detail B {main_kg}:
WhilePrintingRecords;
Shared numbervar kg;
kg

Kg for each record is pulled through correctly to the main report into detail B. I would like to perform a sum in the group footer of the main report but i cannot select the formula {main_kg} in order to total it.

(Note that due to database design I need to have my subreport in the detail section, and therefore cannot summarise in the subreport).

Tks in advance.
 
Change your detail_b formula to:

WhilePrintingRecords;
Shared numbervar kg;
numbervar sumkg := sumkg + kg; //sum the amt
kg //but display the current value

In the group footer use:

WhilePrintingRecords;
numbervar sumkg;

In the group header add this formula:

WhilePrintingRecords;
numbervar sumkg;
if not inrpeatedgroupheader then
sumkg := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top