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

Shared Variable Summaries

Status
Not open for further replies.

kbfnet

Programmer
Nov 16, 2004
28
US
Hello,

I have a shared variable formula that is suppose to sum a column of data and bring back a summary. The formula is populating the field with the last number in the column instead of summarizing the entire column.

I need the report to do this:

Location 21
Employee 7
Hours 21.10
Hours 15.15
Total 36.25

Employee 22
Hours 40.00
Hours 13.44
Hours 15.66
Total 69.00

Total Summary for Location 21: 105.25

Instead what I am getting is the following:

Location 21
Employee 7
Hours 21.10
Hours 15.15
Total 36.25

Employee 22
Hours 40.00
Hours 13.44
Hours 15.66
Total 69.00

Total Summary for Location 21: 69.00

I am using the following formulas:
Subreport Formula:
WhilePrintingRecords;
Shared NumberVar HoursSum := sum ({prearn.curhours})

Main Report Formula:
WhilePrintingRecords;
Shared NumberVar HoursSum

Does anyone have thoughts on how I can get the shared variables to sum the entire column and not just the last entry?

Thanks!
kbfnet
 
Post technical information such as where the subreport is within the main report, and in what sections your formulas are.

I'll assume that the sub is in an employeee group, in which case you should place the following formula AFTER tyhe subreport fires to accumulate the values returned by the subreport, such as in the group footer.

Main Report Formula:
WhilePrintingRecords;
Shared NumberVar HoursSum;
NumberVar TotalSum:=TotalSum+HoursSum;

Now you can reference the total afterwards using:

WhilePrintingRecords;
NumberVar TotalSum

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top