Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculating TIME one record at a time Post Reply Post New Topic
Author Message
rboursaw
Newbie
Newbie
Avatar

Joined: 30 Mar 2008
Location: United States
Online Status: Offline
Posts: 4
Quote rboursaw Replybullet Topic: Calculating TIME one record at a time
     Posted: 06 Apr 2008 at 6:10pm
This is probably an easy one but I'm pretty new to Crystal.  I'm using CR10 and am just trying to create a new column for my report which shows the amount of time in the previous state.
 
The information is coming from a call tracking system and shows the time that the person 'entered' that state.  The time between each start is the amount of time in the previous state (if that makes any sense)  Bottom line, the DB only shows the start times.
 
An example of the output looks like this.
 

wrap-up

04/04/2008 4:26:45 PM

Connected

On Call 1/3181

04/04/2008 4:23:27 PM

ready

04/04/2008 4:20:50 PM

wrap-up

04/04/2008 4:20:04 PM

Connected

On Call 1/3162

04/04/2008 4:18:27 PM

ready

04/04/2008 4:17:00 PM

wrap-up

04/04/2008 4:16:56 PM

Connected

On Call 1/3078

04/04/2008 4:10:00 PM

ready

04/04/2008 4:09:57 PM

wrap-up

04/04/2008 4:09:54 PM

Connected

On Call 1/3067

04/04/2008 4:07:59 PM

 
The bottom entry in the table shows that they started a call (Connected) at 4:07:59 PM and the next event of (wrap-up) shows when they ended the call at 4:09:54 PM.  So, I can easily see that the time spent on the call was just under 2 minutes. 
 
I am trying to create a new column that basically shows the amount of time in each state given that I only have the start time of each state.
 
Any help / direction would be greatly appreciated.
 
Thanks all!
Bob
IP IP Logged
Iago
Groupie
Groupie
Avatar

Joined: 01 Oct 2007
Location: United States
Online Status: Offline
Posts: 52
Quote Iago Replybullet Posted: 15 Apr 2008 at 12:16pm
I have seen this type of question several times on this forum.  I think my answer may not make sense.
 
You have two records for 1 call
Do you have a field that connects those two records, a call ID like 1/3181.  in your example you only show that field for the connected record.
 
What you can do is create two SQL views or two commands that query the same table twice.  In the where clause choose all the wrap_up records in one query and all the Connected records the second query.  Alias the common fields, calltime as startcalltime or calltime as endcalltime. Join those two queries together by call ID 
 
This will put the start time and end time in the same record.  Afer that datediff in a formula should work.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 15 Apr 2008 at 12:56pm
Try using DateDiff. For example DateDiff("n", previous({startdate field}, {startdate field}) would get you the number of minutes between the previous record's start date and the current record's start date.
 
-Dell


Edited by hilfy - 15 Apr 2008 at 1:05pm
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