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

summing formulas by using variables 1

Status
Not open for further replies.

robreports

Technical User
Feb 10, 2010
20
US
I have a formula in the first group footer below the Details section(GF2) that simply multiplies two other formula fields, both of which are also in GF2 but to the left. Each of those two formula fields being multiplied are essentially "one sum subtracted from another sum" in the details section (top/down on the left side)
Now in the next lower group, GF1, I want to "sum the sum" ie I want to sum the results displayed in each GF2 summation formula but of course Crystal Reports will not let me by saying :"This Field Cannot Be Summarized" because it is not a true column/field of data in the table data source.Understood but how do I accomplish the "sum of a sum" in GF2 based on GF1 sums which are formulas? Create number variables?I need help with that please.
 
I think you mistated your goal in the next to the last sentence. You are trying to sum GF2 formulas to display in GF1, correct? If so, create three formulas:

//{@reset for GH1}:
whileprintingrecords;
numbervar sumx;
if not inrepeatedgroupheader then
sumx := 0;

//{@accum} to be placed in GF#2 and suppressed:
whileprintingrecords;
numbervar sumx := sumx + {@yourGF2formula};

//{@displayresult} to be placed in GF#1:
whileprintingrecords;
numbervar sumx;

-LB
 
LBass, that worked great, thanks alot! The last thing I need to do in this report now is add one last summation (Grand Total)into the report footer (RF), summing the those new GF1 summaries you helped me create.Or, couldn't I accomplish the same thing by summing those smaller subtotals in GF2 but display the grand total in the report footer?Whatever is easiest method I suppose. I had never heard of "inrepeatedgroupheader" before.
 
Change the display formula to:

whileprintingrecords;
numbervar sumx;
numbervar gtx := gtx + sumx;
sumx //formula will display this

Then in the report footer, use:

whileprintingrecords;
numbervar gtx;

In the future, please identify your full goal in the initial post, instead of stringing them together.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top