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

how to get summary for HH:mm field??? 1

Status
Not open for further replies.

hatemgamil

Programmer
Mar 18, 2010
41
hi all

i have a field in report "Delay Time" and it's type is string

i want to get summary for this field but i dont know how so i want some help

this field looks like that hh:mm

eg DelayTime
09:03
02:08
01:09

i want to get total to
DelayTime
09:03
02:08
01:09
------------------------------------------
Total 12:20

taking care i want to increment hh (hours) if total number of minutes exceeds 60 min and the hh is up to 23
and make it 1 day if number of hours exceeds 24

thnx
 
@mins
(tonumber(left(yourtime,2)) *60) = (tonumber(rightt(yourtime,2))

Then you need to convert summary to Days:Hours:mins

@total
local numbervar Days:=0
local numbervar Hours := 0;
local numbervar Minutes := 0;
local numbervar TotalMins := sum(@mins);


Days := Truncate(TotalMins / (60*24))
Hours := Truncate((TotalMins-(Days*60*24)) /60);
Minutes := truncate((TotalMins -(Days*60*24) - (Hours * 60)));

Totext(days,0)&":"&totext(hours,"00",0)&":"&totext(minutes,"00",0);

Ian
 
@mins
(tonumber(left(DelayTime,2)) *60) =(tonumber(right(DelayTime,2))

i got and error when creating this formula
 
i think u mean
(tonumber(left(DelayTime,2)) *60) +(tonumber(right(DelayTime,2))
 
Yes I did, just did not hold shift when I wanted to type +

Less haste more speed!!

Ian
 
thnx IanWaterman for ur valuable post

it works fine ,,i will edit ur answer after fixing syntax errors :
create a new Formula Field:
@min
tonumber(left({dt.DelayTime},2)) *60 + tonumber(right({dt.DelayTime},2))

then create another one @Total:

local numbervar Days:=0;
local numbervar Hours := 0;
local numbervar Minutes := 0;
local numbervar TotalMins := sum ({@mins});

Days := Truncate(TotalMins / (60*24));
Hours := Truncate((TotalMins-(Days*60*24)) /60);
Minutes := Truncate((TotalMins -(Days*60*24) - (Hours * 60)));

Totext(days,0)&":"&totext(hours,"00",0)&":"&totext(minutes,"00",0);


thnx again Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top