Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Running totals & detail suppressing Post Reply Post New Topic
Author Message
joeld_mn
Newbie
Newbie


Joined: 07 Mar 2008
Online Status: Offline
Posts: 9
Quote joeld_mn Replybullet Topic: Running totals & detail suppressing
     Posted: 27 Aug 2008 at 2:30pm
Hello,
 
I am using Crystal 10 and creating a report to track on time shipments.  I am grouping by customer.  My ship date field is in the header table and my promise date field is in the detail table so the report returns a line for each item on the order.  Since we ship complete I just want to show one line for each order.  I used this formula in section expert, detail section to suppress extra detail records:
 
{Header.SalesOrderNo} = previous ({Header.SalesOrderNo})
 
I get the results I want. 
 
I then use a formula field "delta" to calculate the difference in the promise date to the ship date.
 
{Header.ShipDate}-{Detail.PromiseDate}
 
I then use some running total fields to get my total orders, on time orders and late orders.  I am getting the correct totals for "total orders" and "late Orders"  but not for "On Time orders".
 
These are the formula's I am using:
 
For total orders: summarize on field header.order number, type is count, evaluate on change of field using header.order number field.  This returns the correct number.
 
For On Time orders: summarize on formula field "delta", type is count, evaluate on Formula which is; {Header.SalesOrderNo}<>previous({Header.SalesOrderNo}) and {@Delta}<=0.  This returns a total one less then I expect.  For the heck of it I added +1 at the end of the formula and my total increased by two. ???
 
For Late orders:  summarize on formula field "delta", type is count, evaluate on Formula which is; {Header.SalesOrderNo}<>previous({Header.SalesOrderNo}) and 0">{@Delta}>0.   This returns the correct number.
 
So what is wrong with the On Time running total?  Should I have approached this a different way?  I thought about grouping by the formula field "delta"  but I didn't know how to just make two groups; one group where the delta<=0 (my on time group) and the other group delta>0 my late group.
 
Thanks for taking the time to respond.
Joel
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 27 Aug 2008 at 3:53pm

In both places where you're comparing the SalesOrderNo to the previous, change the formula to this:

(PreviousIsNull({Header.SalesOrderNo}) or {Header.SalesOrderNo}<>previous({Header.SalesOrderNo}))
 
Notice that I put parentheses around this - you must have them as I have placed them in order for this to work correctly.
 
Basically, I think your problem is due to the face that the first order in your data set is "on time", but there is no previous order to compare it to - any comparison with null is null, not true or false.
 
-Dell
IP IP Logged
joeld_mn
Newbie
Newbie


Joined: 07 Mar 2008
Online Status: Offline
Posts: 9
Quote joeld_mn Replybullet Posted: 28 Aug 2008 at 6:40am
That was exactly what I needed.  Now if I can just remember this for the next time!
 
Thank you Dell. 
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