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!

summing a formula in header 1

Status
Not open for further replies.

krysna

Programmer
May 20, 2008
22
I have a somewhat complicated report where I need to sum sums, and CR does not seem to want to let me.
Here is how it is set up:
Group 1 = AARow
Group 2 = Fund
Details are not shown, as I only want to see totals for the fund.
Depending on the value of the AARow and another field that is part of the record (AACol), I place either the value from the record, a 0, or the value from column 1 subtracted from column 2.

if {RptStmtOfActivities.AACol} < 6 then
if {RptStmtOfActivities.AARow} < 200 then
Sum ({RptStmtOfActivities.Fees}, {RptStmtOfActivities.Fund})-Sum ({RptStmtOfActivities.Expenses}, {RptStmtOfActivities.Fund})
else 0
else Sum({RptStmtOfActivities.GovtActivities}, {RptStmtOfActivities.Fund})

This is all fine, but then I need to show a total at the bottom of each group. My formula for the column does not show up in the dropdown for doing a summary, nor does it appear when I try to do a running total. I've tried to select the sum when I try to set up a running total, but when I do, I get "invalid field selection."
This does not seem like something that should be impossible. All I want to do is total up the numbers showing in the column at the bottom of each group, but CR won't let me.
Please help; I am at my wit's end.
 
Here's where variables are handy. Create three formulas:

//{@reset} to be placed in the group #1 header:
whileprintingrecords;
numbervar grpsum;
if not inrepeatedgroupheader then
grpsum := 0;

//{@accum} to be placed in the section containing {@yourformula} (group #2 section?):
whileprintingrecords;
numbervar grpsum := grpsum + {@yourformula};

//{@display} to be placed in the group #1 footer:
whileprintingrecords;
numbervar grpsum;

Note that if {@yourformula} is a currency, then you would need to change "numbervar" to "currencyvar" in each formula.

-LB
 
Thank you SOOO much! That did the trick! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top