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

Anyway to total a time formula for day, week, and month?

Status
Not open for further replies.

mvalley

Technical User
Mar 4, 2011
80
US
I have a report that has a field in the detail section that is a formula. This formula totals the time for cases after 1600 to display in mins and hours for each case that meets the criteria. (@TimeAfter1600)
I have been asked if I could display a total of all minutes for all cases for each day, week and again for each month. Below is some examples


Total Time after 1600 for day 1 is two cases,
1st case is 2hr 02 mins and
2nd case is 1 hr 05 mins
Total daily = 3hrs and 07 mins

Add next day case for 1 hr and 25mins
Total weekly = 4hrs and 32 mins

Add case several days later for 49 mins
Total Monthly = 5 hr and 21 mins

I’m sure this is possible; I just do not know how to do it. I hope my explanation makes sense. I would love some expert guidance, as is always the case with this forum. Thanks, Mary
 
You need to show the contents of all formulas. Then what you will need to do is convert the string formula(s) into numbers (minutes) that can be worked with in calculations.

-LB
 
not sure what you mean. This is the content of the formula @TimeAfter1600:
WhilePrintingRecords;
Shared NumberVar TotalTime;
Shared NumberVar Hours;
Shared NumberVar Minutes;

TotalTime:={v_CRA_20_Billing_Summary.time_pat_out_of_room}- {@StartTime_modified};

Hours:=Int(TotalTime/100);
Minutes:=TotalTime-(Hours*100);

IF Minutes > 59 THEN
Minutes:=Minutes-40
ELSE
Minutes;

IF Hours = 0 THEN
ToText(Minutes,"00") & " mins"
ELSE
ToText(Hours,"0") & " hrs " & ToText(Minutes,"00") & " mins";



IF Hours = 0 THEN
ToText(Minutes,"00") & " mins"
ELSE
ToText(Hours,"0") & " hrs " & ToText(Minutes,"00") & " mins";

How can I do what you suggest?
 
What is the content of {@StartTime_modified} and of any nested formulas?

What is TotalTime returning? Seconds? Minutes?

Also, I am confused about why you divide by 100 to get hours. Please explain.

-LB
 
@StartTime_modified is a formula used to show how many minutes after a certain time a case is being done (4pm)
{@StartTime_modified} = if{ pat_in_room}<1600 then 1600 else{pat_in_room}

Total time returns minutes if under 60, hours & minutes if over 60

Divided by 100 based on a solution post for the issue of result of 104 needing to be 1 hr 4 mins vs 64 mins. I don’t know why, but it works.
 
I think you are going down a dangerous road by working with a number that really has string-type logic. I think you should change your original formula so that you are working with actual numbers. Then secondarily tackle the above.

-LB
 
Thanks for the advice. Quess I will go back to the beginning to see if I can figure this out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top