Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Topic: Summation Issue at the Group Footer Posted: 25 Mar 2008 at 10:37am
Hi ,
I have a scenario where I dont want to add the gross amounts of the records if the previous record has the same Rec No value as the current record in the group footer
Detail records will be something similar to this
State City Rec No Gross Amount
MI Detroit 1111 100$
MI FI 1111 100$
GroupFooter ( Grouped on State )
Sum of Gross Amount Field should only display 100$ instead of 200$.
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Posted: 25 Mar 2008 at 9:01pm
You need a custom running total field. Use the PreviousValue() function to compare the current Rec No to the previous Rec No. If they are different then add it to the Global variable. In the Group Header, reset the Global variable back to zero.
Then main running total formula would be something like this:
Global NumberVar TotalAmount; if {table.Rec No} <> PreviousValue({table.Rec No}) then TotalAmount := TotalAmount + {table.Amount};
I cover custom running totals in detail in Chapter 3 of my book. You can find out more about my books at
Amazon.com
or reading the Crystal
Reports eBooks online.
Edited by BrianBischof - 25 Mar 2008 at 9:04pm
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>
Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Posted: 27 Mar 2008 at 8:23am
Brian,
I think i have one more issue. I dont have to compare the whole record but I have to compare multiple columns in a record. It works if i do for one column. below is the code
I created a Running total field and under evaulate, I used use a formula and my formula looks like this
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Posted: 27 Mar 2008 at 10:52am
Yes, you can create very complex formulas in the Evaluate section. The problem is getting the logic to those formulas working!
However, the formula looks fine to me. Do you want it to skip the test when BOTH fields are the same as the previous record or only when either field is the same? Right now it should be doing it for both of them. You can use an "OR" operator to make it either field.
Does that help?
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>
Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Posted: 27 Mar 2008 at 11:05am
I needed to look for both the conditions so what i did was combined both fields and used that in the formula section and it works perfectly. Thanks much.!
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