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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimum Time versus Maximum Time

Status
Not open for further replies.

eric333

IS-IT--Management
Nov 3, 2007
76
US
Good evening,

I have a series of records that have a date and time stamp. I have grouped the records by two levels (reference number and employee ID). I need to identify the earliest record (minimum) and the latest record (maximum) and then calculate the time difference between the two. Does anyone have any suggestions?
 
The earliest and latest record within the innermost group? If so, use:

datediff("s",minimum({table.datetime},{table.employeeID}), maximum({table.datetime},{table.employeeID}))

This assumes that refno is group #1 and employee ID is group #2.

-LB
 
Thanks!!

So that returns the value in seconds. How do I display that value in HH:MM:SS format?
 
Oh yeah...one more thing, I also need to insert totals at the reference number level (in other words, the total amount of time spent on this particular reference number, and a grand total for all time spent. The formula field I created to calculate the difference is not listed in the fields to summarize.
 
You should lay out the entire requirement in your first post, instead of stringing them.

To get the values per higher order group and for the grand total, you have to use the seconds for the calculation, and then in the display formula, convert the result to a string.

//[@reset} for the refno group header (suppress the formula):
whileprintingrecords;
numbervar refnotot;
if not inrpeatedgroupheader then
refnotot := 0;

//{@accum} to be placed in the employeeID group header or footer and suppressed:

whileprintingrecords;
numbervar refnotot := refnotot + datediff("s",minimum({table.datetime},{table.employeeID}), maximum({table.datetime},{table.employeeID}));
numbervar grtot := grtot + datediff("s",minimum({table.datetime},{table.employeeID}), maximum({table.datetime},{table.employeeID}));

//{@displrefnotot to be placed in the refno group footer:
whileprintingrecords;
numbervar renotot;

//{@displgrtot} for the report footer:
whileprintingrecords;
numbervar grtot;

Within the last two display formulas, build in the conversion to string by setting "dur" := to the particular variable, using faq767-3543.

-LB
 
Thanks for the information, and sorry for not including the original requirements. I thought the calculations would be easier once I had the minimum and maximum defined. Anyways, the suggestions are a bit over my head, but I'll try. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top