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
RichardH1976Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.