• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 515
  • Last Modified:

crystal reports - summarise a formula field

I have picked up a report off someone who has left the company.  He has built the report with subreports to calculate a total and then a formula field to summarise each total.   The formula field is in a group footer to give a total by country.

I cannot summarise a formula field so have tried to calculate with variables.   the formula field is territoryordered.

So far I have in the report header.
(
WhilePrintingRecords;
Global NumberVar GTotal;

in the group header where the formula field is;
WhilePrintingRecords;
Global NumberVar GTotal;
GTotal:=GTotal+{@TerritoryOrdered};
GTotal

This is giving me the wrong total.  I would like to display the total in the report footer but I cannot get the correct amount to display in the group header.

Sorry I bet this is simple...   Richard
0
RichardH1976
Asked:
RichardH1976
  • 2
1 Solution
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Place {@TerritoryOrdered} in the group header.  Does it show the value you expect?  If not, look inside that formula to figure out the problem.  
Note: if that main report formula is grabbing a value from a subreport placed in the same group header, you must move that formula to a section BELOW the subreport section. For example, place the formula in GF1 or GH1b if the subreport is in GH1a.  This is because, within a section, formulas are evaluated before subreports.
0
 
mlmccCommented:
What is the @TerritoryOrdered formula?

As written the value in the group header will be  "running" total for the report to that point.

Are you trying to get the total of the formula for the group?

mlmcc
0
 
RichardH1976Author Commented:
The @territoryordered is a variable that adds all variables totals up which are in sub reports,  these are all in group headers.  1a, 2a, 3a etc...  There are 10 different territories and I get sub totals for each one.   I need to grand total the territory ordered formula field.
0
 
mlmccCommented:
Change your formula in the Group Header to
EvaluateAfter({@TerritoryOrdered});
 Global NumberVar GTotal;
 GTotal:=GTotal+ {@TerritoryOrdered};
""

Open in new window


IN the report footer
WhilePrintingRecords;
Global NumberVar GTotal;
 GTotal

Open in new window


mlmcc
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now