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?
jwebster77Asked:
Who is Participating?
 
peter57rCommented:
Well we could go round in circles defining each formula field.. but i suspect we will end up in the same place..

In the report header add a variable..

 //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
 
peter57rCommented:
Please post the formula field code.
0
 
jwebster77Author Commented:
{@TimeHalf} * {@TimeHalfRate}=@overtimedollar

Overtimedollar is the field I need to add and display in report footer.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
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
 
jwebster77Author Commented:
K.  @TimeHalf is = If {#TotalFinalHours} > 40 Then
    {#TotalFinalHours} - 40
Else
    0

@TimeHalfRate is = {CTL_HOURLY.CURRENTRATE} * 1.5
0
 
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
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
 
peter57rCommented:
Indeed.

When I posted my 3 formulas above, I hadn't anticipated a running total being used in a formula field.
0
 
GJParkerCommented:
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
 
James0628Commented:
 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.

All Courses

From novice to tech pro — start learning today.