Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to Add Value of Formula Field to Summary Field Post Reply Post New Topic
Author Message
pitbowtek
Newbie
Newbie
Avatar

Joined: 20 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote pitbowtek Replybullet Topic: How to Add Value of Formula Field to Summary Field
     Posted: 20 Feb 2008 at 2:39pm
I have created an Invoice Report for a Shipping Dept as follows:
 
Group1 - 'Dept#'   'Dept Name'
    Group2 - 'Carrier'  'TotalCarrierPieces'  'TotalCarrierCost'
        Group3 - 'Class'  'TotalClassPieces'   'TotalClassCost'
Group3 is Grouped in Specified Order as Either 'Presort' or 'FirstClass' and is conditional to Group2 Carrier = USPS
 
That all works fine. However, I need to add a PerPieceFee At the Group3 Level is 'Class' = 'Presort'
I have also accomplished this using a FormulaField in Group3 Footer so that the Fees Display under the Presort Line.
 
My Problem is I need to ADD the Presort Fees Calculated to the Total Displayed as the Group1 TotalCarrierCost
 
EXAMPLE:
 
100 Accounting
     UPS     2     $20.00
     DHL     1     $10.00
     FEDEX 1     $11.00
     USPS   200 $82.00
       1stClass 100   $41.00
       Presort   100   $41.00
         PresortFees   $01.20
     TOTAL  204 $123.00 <- I need this value to reflect the additional 1.20 in fees that were calculated but not part of the actual field Data.
 
As you can probably tell from my attempts to communicate this I am very much an amature at this 'coding' stuff, I know enough to be dangerous.
 
I figure I have to create some variable and then use that to add to the Summary Total for Group1. Or use Running Totals or something, but I cannot figure out how to make this work. I have created functions that pass the test but the value never includes the value from the formula field, I'm assuming since it is not a 'stored' value.
 
Any help to get me on the right track would be much appreciated, this is only thing keeping this from being a completed report.
 
Thanks in Advance!
Dean 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 21 Feb 2008 at 6:33pm
Well, it sounds like you've done really well so far. You just need a little more to get over the hump. Create a formula with the Sum() function in it and add the varialble to it that tracks the $1.20 in fees. Something like this:
NumberVar XtraFees;
//XtraFees is calculated in the FormulaField in Group3 footer
Sum({summed field}, {group field}) + XtraFees;

If this doesn't give you the right amount, then modify the formula to ONLY return the Sum() function. Then compare it to the current running total already displayed on the report. That way you can make sure you passed the proper fields to it. It's also easy in the formula expert to drag and drop the summary field from the existing Report Fields list into the formula. That way you don't have to figure anything out b/c Crystal will enter the correct Sum() function for you.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pitbowtek
Newbie
Newbie
Avatar

Joined: 20 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote pitbowtek Replybullet Posted: 26 Feb 2008 at 5:59am
Thank You, that 'should' work however the 'value' of the Formula Field 'PresortFees' that is in Group3Footer has a 'value' of Zero if I drag it to the Group1Footer where I need to add it to the SumTotal. So your code is probably correct, but the value I'm trying to add is Zero by that point.
 
'PresortFees' formula is Group3Pieces * .012
and it displays fine at the Group3Level which is where the data it is based on is.  While it is suppressed, I'm guessing it would also calculate for all the other carriers which would be zero as there is no Condition 'presort' for them. Group3 only exists if Group2 Carrier=USPS and the Group3 Catagory=Presort
 
So after my value is displayed Group2 also displays DHL and UPS neither have group3 displayed, but it is probably still calculating in the background and would then have values of 0 for those two groups. Then we arrive back at the Group1Footer where that value is zero now.
 
I need to somehow hold that value to be added later.
 
I was looking at 'WhileRecords' or Running Totals as a possible way to do it, but a bit over my skill level ATM.  Seems I need to hold that value that would reset on the Change of Each Group1
 
Hope this makes sense.
Its frustrating to be this close but so far over my ability to complete.
Thanks in Advance for your Continued Support.
Dean
IP IP Logged
pitbowtek
Newbie
Newbie
Avatar

Joined: 20 Feb 2008
Location: United States
Online Status: Offline
Posts: 4
Quote pitbowtek Replybullet Posted: 28 Feb 2008 at 8:50am
I was able to resolve this problem with a Conditional Running Total, once I figured out how to use them.
 
Thanks!
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum