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

Problem with Grouping Formula ?

Status
Not open for further replies.
Dec 11, 2003
1
GB
Hope someone can help. I think the problem is with the grouping but not sure what.

I have written a formula for converting time in miuntes ( Calls.TimeTaken) into days/hours/minutes. It is based on a working day so 8 hours (480 minutes) = 1 day.

If the times it is adding up do not go into days then it is ok, but if it involves days as well as hours and minutes, then its a problem! This is the formula:



NumberVar ReqHours;
NumberVar ReqMinutes;
NumberVar ReqDays;
ReqDays:=Sum ({Calls.TimeTaken}, {CallsUpdate.DepartmentNew})/480;
ReqDays:=Truncate(ReqDays);
ReqHours:=Sum ({Calls.TimeTaken}, {CallsUpdate.DepartmentNew})/60-(ReqDays*480);
ReqHours:=Truncate(ReqHours);

if ReqHours<0 Then (ReqHours:=Sum ({Calls.TimeTaken}, {CallsUpdate.DepartmentNew})/60;
ReqHours:=Truncate(ReqHours);
ReqHours:=ReqHours-(ReqDays*8);
ReqHours:=Truncate(ReqHours) ) Else

ReqMinutes:=Sum ({Calls.TimeTaken}, {CallsUpdate.DepartmentNew})-(ReqHours*60);
ToText(ReqDays,0)+&quot; Days &quot;+ToText(ReqHours,0)+&quot; Hours &quot;+ToText(ReqMinutes,0)+&quot; Minutes&quot;

Thanks
 
A sample of the data, along with CR version would help here....

Reebo
UK

&quot;Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.&quot;
- Albert Einstein (1879-1955)
 
Your &quot;grouping&quot; formula will not work since you are using summary functions in it...

eg. Sum ({Calls.TimeTaken}, {CallsUpdate.DepartmentNew})

such formulas cannot be used in grouping formulas.

What is it that you are trying to achieve? Is it a ranking of the final result of time....the function,Top N, may be your answer

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top