Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Difference between fields in rows Post Reply Post New Topic
Author Message
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Topic: Difference between fields in rows
    Posted: 16 Dec 2013 at 10:56pm
Hi All,

I need to get the time difference between two date field in the details section. And then, get the sum of the time difference field.

Sample:
[Details section]

Case# |    Started Date       |    Duration (mins)
01          01/11/2013 09:00              0
02          01/11/2013 10:00              60
03          01/11/2013 12:00              120

[Group Footer]
I would like to show the summary of the duration mins, which will be 180 in this case.

I am using this formula to get the duration
DateDiff("n", Previous({STARTED DATE}), {STARTED DATE})
But I don't think I can use this to calculate the sum of the duration.

My head is hurting Confused... does anyone have any suggestion how to tackle this situation?
I am happy to change the datediff formula as long as I can get the total duration......

Many thanks!!!

IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 16 Dec 2013 at 11:03pm
Hi

Create the following two formulas to get the total difference :


whileprintingrecords;
Numbervar hr:=hr+{@datediff_Formula}  //your date diff. formula.

Place the above formula in your detail section i.e. where you are calculating time difference.

Whileprintingrecords;
Numbervar hr;


Place this formula in your report footer to get totals.
Thanks,
Sastry
IP IP Logged
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Posted: 17 Dec 2013 at 1:11am
Thanks Sastry for giving me the idea! Thumbs%20Up
My report is looking more hopeful now.

I have added another formula to initialize the variable and put in the Group Footer. Otherwise, it will carry the previous value over.

[Group Header]
Initialize the variable

[Details]
Variable calculation

[Group Footer]
Displaying the variable result

Thanks again!!!!! (and Merry Christmas!!!)
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.