Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Problem

Status
Not open for further replies.

ecugrad

MIS
Apr 17, 2001
191
US
Need Some Help.. I'm trying to get the total worktime that one of our scanners have been scanning. Each time a document goes through the scanner we assign a batch number to it and record the Starttime that it started scanning and an endtime when scanning completed. We can start a another batch before the first is complete. So my times can look like the below.

Batch: StartTime Endtime
1001 3/27/02 6:00:00 3/27/02 6:00:09
1002 3/27/02 6:00:05 3/27/02 6:00:15
1003 3/27/02 6:00:12 3/27/02 6:00:20

Using DateDif for each batch and summing I get 27 Seconds, what I need is the difference from the first Starttime and Last Endtime, which would be 20 seconds..

Thanks,

 
I do not understand how you got 27 seconds. I would do a grand total minimum of start time and maximum of end time, then take those differences.

If this does not work cut and paste your formula in the next post.


Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
dgillz, that worked. First let me explain how I got 27 secs. I used datedif on each batch and then summed them:
9+8+10=27. I still have a problem tying to get to my desired result. If my scanner is not used for an hour or it was turned off for maintnance and then scanning resumed, using DateDif with Min StartTime and Max endTime would not give me a true number. If you look at the example below, one batch can start before another ends and that where my problem comes in when trying to get an actual time count.

Thanks,




Batch: StartTime Endtime Sec
1001 3/27/02 6:00:00 3/27/02 6:00:09 9
1002 3/27/02 6:00:05 3/27/02 6:00:15 10
1003 3/27/02 6:00:12 3/27/02 6:00:20 8

 
What you want to do is capture the first StartTime and last EndTime in a formula.

This can be done in a couple of ways.

The easiest is in the Group footer create the following formula:

@Workingtime

whilePrintingRecords;
datediff("s",minimum({table.StartTime},{Table.groupfield}),
maximum({table.EndTime},{Table.groupfield}));

I think this will work.
Jim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top