Mr. Vampire,
I'm having trouble converting the results back into a time format. Excuse me, but I'm hoping that you can give me some direction as I'm borrowing heavily from your work. Please take a look at the following:
FORMULA #1 (totaling the time diffeences of individual records in a group)
Shared DateTimeVar PID7E;
Shared DateTimeVar PID16S;
numberVar dur := datediff("s",PID7E, PID16S); //get the seconds between 2 dates
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);
hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");
If PID7E <> #01/01/1900# and PID16S <> #01/01/1900# and PID7E < PID16S then
hhmmss
else
totext("0") + ":" + totext("00") + ":" + totext("00");
WORKS GREAT!
FORMULA #2 (a group field that sums the above formula)
whileprintingrecords;
numbervar secs:= secs + (val(left({@XOpID7-16},2))/3600)
+
(val(mid({@XOpID7-16},4,2))/60)
+
val(mid({@XOpID7-16},7,2));
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(secs/60)/60);
min := Remainder(Truncate(secs/60),60);
sec := Remainder(secs,60);
hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");
hhmmss
This formula does work, but it rolls all the time into one number. Shouldn't I be breaking out the Hrs, Mins, & Secs before doing the division?
Any help would be appreciated!
THANK YOU!