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

Time related formula calculating incorrectly 1

Status
Not open for further replies.

sdzlkds

Technical User
Oct 20, 2005
41
GB
I'm running a report which looks at call centre stats. The report shows Answered calls, Total time waiting for a call, and average time waiting for a call.

The average time waiting for a call is calculated by Total time waiting for a call/Answered calls. So an example would be 18:19:10 (HH:MM:SS) / 583 = 00:01:53, however when attempting to do this on Crystal I get a different answer (00:01:48). The formula used is shown below, where
Total time waiting for a call = {magent.ti_auxtime0} and
Answered calls = {magent.acdcalls}
({@Associate} is a grouping by call cente staff names)

Any assistance would be appreciated. I am using Crystal 10.

FORMULA

whileprintingrecords;
numberVar dur :=

Sum ({magent.ti_auxtime0}, {@Associate})/Sum ({magent.acdcalls}, {@Associate});

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,"00") + ":" + totext(min,"00") + ":" + totext(sec,"00");

hhmmss
 
just tested this formula by hard coding the time converted to a number as follows:

whileprintingrecords;
numberVar dur := 65950/583; //etc.

The result was: 00:01:53.

It looks like you are converting incorrectly. The conversion should be:

val(left({table.string},2)) * 3600 +
val(mid({table.string},4,2)) * 60 +
val(right({table.string},2))

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top