My post is similar but not exact to
I have the following formula that finds the difference between two DateTime fields and converts it to XX:XX:XX:XX format (string):
//Convert Total Seconds to DD:HH:MM:SS
//Remove comment tags to format in
//Days X, Hours X, Minutes X, Seconds X
//and add comment tags or delete DD:HH:MM:SS formating.
NumberVar TotalSec := datediff("s",NthLargest (1, {@open_time}, {SERVICE_CALL.SERVICE_CALL_ID}), ({@min_vendor1}));
NumberVar Days := Truncate (TotalSec / 86400);
NumberVar Hours := Truncate (Remainder ( TotalSec,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
NumberVar Seconds := Remainder ( TotalSec , 60);
//comment or delete the following to format it
//with the text instead of looking like 12:05:21:05
ToText ( Days, '00', 0,'') + ':'+
ToText( Hours, '00', 0,'') + ':'+
ToText ( Minutes,'00', 0,'') + ':'+
ToText( Seconds,'00', 0,'')
//'Day(s) ' + Totext ( Days, '00', 0,'') + ' ' +
//'Hour(s) ' + Totext ( Hours, '00', 0,'') + ' ' +
//'Minute(s) ' + Totext ( Minutes,'00', 0,'') + ' ' +
//'Second(s) ' + Totext ( Seconds,'00', 0,'')
It works great! I end up with group footers listing similar output:
00:00:15:00
00:21:15:00
00:00:15:45 ... and so on
What I want/need is a way to average this output. In my 3 line eg above I'd end up with 00:07:15:15 in my report footer.
I have the following formula that finds the difference between two DateTime fields and converts it to XX:XX:XX:XX format (string):
//Convert Total Seconds to DD:HH:MM:SS
//Remove comment tags to format in
//Days X, Hours X, Minutes X, Seconds X
//and add comment tags or delete DD:HH:MM:SS formating.
NumberVar TotalSec := datediff("s",NthLargest (1, {@open_time}, {SERVICE_CALL.SERVICE_CALL_ID}), ({@min_vendor1}));
NumberVar Days := Truncate (TotalSec / 86400);
NumberVar Hours := Truncate (Remainder ( TotalSec,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
NumberVar Seconds := Remainder ( TotalSec , 60);
//comment or delete the following to format it
//with the text instead of looking like 12:05:21:05
ToText ( Days, '00', 0,'') + ':'+
ToText( Hours, '00', 0,'') + ':'+
ToText ( Minutes,'00', 0,'') + ':'+
ToText( Seconds,'00', 0,'')
//'Day(s) ' + Totext ( Days, '00', 0,'') + ' ' +
//'Hour(s) ' + Totext ( Hours, '00', 0,'') + ' ' +
//'Minute(s) ' + Totext ( Minutes,'00', 0,'') + ' ' +
//'Second(s) ' + Totext ( Seconds,'00', 0,'')
It works great! I end up with group footers listing similar output:
00:00:15:00
00:21:15:00
00:00:15:45 ... and so on
What I want/need is a way to average this output. In my 3 line eg above I'd end up with 00:07:15:15 in my report footer.