Turkbar,
This is the formula I found on this site under another thread. Everything shows the formual is ok until it gets to the section below //display dd-hh:mm:ss and state the remaining text does not appear to be part of the formula. As far as I know the data is in time form.
//This is the display of the response time in the (Day,hr,min,sec) dd-hh:mm:ss format
whileprintingrecords;
NumberVar totalsecs:=(((({@Date Time At Scene}-{@Date Time Received})*24)*60)*60);
Numbervar dd:=0;
Numbervar hh:=0;
Numbervar mm:=0;
Numbervar ss:=0;
//for trips that never got on scene
If {Trips.atsdate} = "1900-01-01" then totalsecs:= 0 else totalsecs:=totalsecs;
If totalsecs < 0 then
(
//for trips that had a negative response time
//Days
If totalsecs <= -86400 then (dd:=Truncate (totalsecs/86400,0); totalsecs:=totalsecs - (dd*86400));
-(dd*86400));
//Hours
If totalsecs <= -3600 then (hh:=Truncate (totalsecs/3600,0); totalsecs:=totalsecs-(hh*3600));
//minutes
If totalsecs <= 60 then (mm:=Truncate(totalsecs/60,0); totalsecs:=totalsecs-(mm*60));
//Seconds
ss:=totalsecs;
If dd=0 then
//display hh:mm:ss
ToText(hh,"00",0)+ "-" + ToText(mm,"00",0)+ ":" + ToText(ss, "00",0)
//display dd-hh:mm:ss
ToText(dd,"00",0)+ "-" + ToText(hh,"00",0)+ ":" + ToText(mm,"00",0)+ ":" + ToText(ss,"00",0)
)
Else
(
//for trips with a normal response time
//Days
If totalsecs>= 86400 then (dd:=Truncate (totalsecs/86400,0); totalsecs:=totalsecs-(dd*86400));
//Hours
If totalsecs>= 3600 then (hh:=Truncate (totalsecs/3600,0); totalsecs:=totalsecs-(hh*3600));
//Minutes
If totalsecs>= 60 then (mm:=Truncate (totalsecs/60,0); totalsecs:=totalsecs-(mm*60));
//Seconds
ss:=totalsecs;
If dd=0 then
//display hh:mm:ss
ToText(hh,"00",0)+ ":" + ToText(mm,"00",0)+ ":" + ToText(ss,"00",0)
else
//display dd-hh:mm:ss
ToText(dd,"00",0)+ "-" + ToText(hh,"00",0)+ ":" + ToText(mm,"00",0)+ ":" + ToText(ss,"00",0))
What I am wanting to do is get the average for response times from {trips.calltime} - {trips.astime}. I have tried average {trips.calltime}-{trips.astime} and it gives me an error that a number is expected in the calltime & astime. I may be mistake about the form the data is in. I did find another formula on her that converted the calltime field(string) into an actual time here is that formula
//Converts the calltime field (string) into an actual time field for Crystal.
//This field is the time that the trip was saved in RightCAD
Time(ToNumber(Left({Trips.calltime},2)), ToNumber(Mid({Trips.calltime},4,2)), ToNumber(right({Trips.calltime},2)))
I also had to do it for the astime (at scene time). Is there another formula I need or am I just not doing something right?