# I have a formula field in a group footer. I need to sum that formula field in the report footer.

Hi,

I am using Crystal REports.  I have a formula field in a group footer.  I need to sum said formula field in the report footer.  How can I do this?
###### Who is Participating?

Commented:
Well we could go round in circles defining each formula field.. but i suspect we will end up in the same place..

//I'm assuming that {@TimeHalfRate} is currency - it it's number then change the variable type
currencyvar otTotal:=0;
""

in @overtimedollar modify to...

whileprintingrecords;
currencyvar ottotal;
ottotal:=ottotal+{@TimeHalf} * {@TimeHalfRate};
{@TimeHalf} * {@TimeHalfRate}

in the report footer add another formula field..

whileprintingrecords;
currencyvar ottotal;
ottotal

0

Commented:
Please post the formula field code.
0

Author Commented:
{@TimeHalf} * {@TimeHalfRate}=@overtimedollar

Overtimedollar is the field I need to add and display in report footer.
0

Since this is a nested formula, you'll also need to post the code behind the other formulas, too.  That being said, my gut feeling is you may need to create a running total or manual running total in order to summarize the group formula. We'll be able to provide more detail once we see the code.
0

Author Commented:
K.  @TimeHalf is = If {#TotalFinalHours} > 40 Then
{#TotalFinalHours} - 40
Else
0

@TimeHalfRate is = {CTL_HOURLY.CURRENTRATE} * 1.5
0

I think you're going to run into problems, since you're using running totals as the basis for your nested formulas.  In other words, you'd have to take a running total of a running total.  That won't work.  You'll need to take the basic requirements for the original running total and expose them in your new manual running total rather than just refer to the formulas that use them.
0

Commented:
Indeed.

When I posted my 3 formulas above, I hadn't anticipated a running total being used in a formula field.
0

Commented:
You should be able to do this with a manual running total, based on the @overtimedollar formula as long as you include teh instruction on when to evaluate

//@OvertimeDollarTotal Accum - Place this in the group footer
EvaluateAfter({@overtimedollar})
WhilePrintingRecords;
NumberVar OTDTotal := OTDTotal + {@overtimedollar}

//@OvertimeDollarTotal Display - place this in the report footer
WhilePrintingRecords;
NumberVar OTDTotal

0

Commented:
GJParker,

FWIW, I don't see any point to using EvaluateAfter, since you're using @overtimedollar in your formula.  I don't think it will do any harm either.  It just doesn't seem necessary.

And it seems to me like Peter's formulas would work, as long as @overtimedollar only produces "real" figures that should be included in the total, and isn't sometimes suppressed or something.  If it was sometimes suppressed, those suppressed figures would also be included in the total in Peter's version.  But if it only produces figures that should be included in the total, I don't see a problem.  But I could be missing something.

James
0
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.