Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Elapsed Time Field Formula Post Reply Post New Topic
Author Message
JenH
Newbie
Newbie
Avatar

Joined: 01 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote JenH Replybullet Topic: Elapsed Time Field Formula
    Posted: 02 Jul 2009 at 1:44pm
CR101, have a CR2008 created.  Events are grouped by ID.  The ID details have several subdetail sections, all of which are data fields that are event time.
 
Trying to create a 'running total' field to add up the event times in each group to create an elapsed time (total time between all transactions, number of transactions variable by group).
 
Thanks, I'm a first timer, go easy on me.
 
Ouch
JenH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2009 at 8:56am
Can you post a little sample row data and how you want that calculated?

Edited by DBlank - 07 Jul 2009 at 8:56am
IP IP Logged
JenH
Newbie
Newbie
Avatar

Joined: 01 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote JenH Replybullet Posted: 07 Jul 2009 at 9:08am

Thanks for asking, here is a series of events, that is 1 logical grouping:

 
Call Placed           2009-06-23 10:54:37.953      4489
Call Cancelled      2009-06-23 10:54:50.967      4489
Call Answered     2009-06-23 10:54:50.983      4489
Service Placed     2009-06-23 10:54:57.407      4489
Call Hangup        2009-06-23 10:55:06.000       4489
Call Placed          2009-06-23 10:55:35.283       4489
Call Cancelled     2009-06-23 10:56:05.253       4489
Call Placed          2009-06-23 10:56:05.503       4489
Call Cancelled      2009-06-23 10:56:42.283      4489
Service Cancelled 2009-06-23 10:56:42.300     4489
Call Point Free      2009-06-23 10:56:45.237     4489
 
The 3rd column is the group, the data in the middle varies, but is sequential.  Rather than show the time of each subsequent event (as shown above) I want to show a start time, then a cumulative time for each event afterwards.  So above I want to show as:
 
Call Placed             2009-06-23 10:54:37.953        4489
Call Cancelled                                  00:00:13        4489
Call Answered                                   00:00:13        4489
Service Placed                                   00:00:20        4489
Call Hangup                                      00:00:29        4489
Call Placed                                        00:00:58         4489
Call Cancelled                                   00:01:27        4489
Call Placed                                        00:01:27        4489
Call Cancelled                                   00:01:47        4489
Service Cancelled                               00:01:47        4489
Call Point Free                                   00:01:50        4489
Total Elapsed time   xxxxxxxxxxx
 
Thanks
JenH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2009 at 9:16am
So it appears that your first row is the start time, all subsequent rows are the timer elapsed since the first row and your "Total Elapsed Time" will duplicate the total time from the last row...Is that correct?
 
If so, does each row have the "2009-06-23 10:54:37.953" field associated to it or is it only the in the first row?
 
IP IP Logged
JenH
Newbie
Newbie
Avatar

Joined: 01 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote JenH Replybullet Posted: 07 Jul 2009 at 9:19am
Correct.  Each row does have the long date time field associated with it.
JenH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2009 at 9:29am
Sorry, that was a poorly written question on my part...
Does each row have the actual start time in it or does it only have it's own time (meaning from your sample data, in one row is there a column with that always has the "2009-06-23 10:54:37.953" value in it and also a second column that would have it the field of it's own time record as well)?
Basically, can you use two fields in the same row to subtract the values or do you have to keep looking at the first row in the group to get the starting time?
 
 
IP IP Logged
JenH
Newbie
Newbie
Avatar

Joined: 01 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote JenH Replybullet Posted: 07 Jul 2009 at 11:25am
I am afraid not.  Each line item only has it's own event time. 
JenH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Jul 2009 at 2:57pm
OK.
For some reason my brain has not quite gotten back to work from a long weekend Wacko but here is the premise of a solution...
At the grouping of field "4489", set a summary function of the time stamp field to Minimum (basically activate the datetimefield, cilck on the sigma sign button, set it to 'Minimum' and location group footer1).
Now you can use that in a formula field per row to do a datediff to get the total seconds of difference then alter that to display as the h:m:s formatting you want. Thi sis where my brain is frozen up as I cannot think how to get the hours to work right without rounding up...maybe you can tweak this or someone else will fix it...It will be something like:
totext(datediff("s",Minimum ({Table.DateTime}, Group1Field, "daily"),{Table.DateTime})/3600,0,"") + ":" +
totext(remainder(datediff("s",Minimum ({Table.DateTime}, group1 field, "daily"),{Table.DateTime}),3600)/60,0,"") + ":" +
totext(remainder(datediff("s",Minimum ({Table.DateTime}, group1Field, "daily"),{Table.DateTime}),60))
 
 
 
IP IP Logged
JenH
Newbie
Newbie
Avatar

Joined: 01 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote JenH Replybullet Posted: 08 Jul 2009 at 2:08pm
The datediff works well to do the subtraction, but as you say it displays as a numerical amount.  If anyone knows how to get this that would be great!
JenH
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.