In my table I have columns: TimeIn, TimeOut, and TimeWork where I calculate difference between TimeIn and TimeOut in column TimeWork using functions TimeToNum and NumToTime in FormCalc. I would like to calculate total hours of column TimeWork . For instance:
I havent had a lot of fun with time calculations but here is something i worked up to change hours into days and hours. You can modify it further as needed. This might get you closer to what you are after.
I have a NumericField with the hours total and a TextField to display the result. In the exit event of the NumericField (you could put it elsewhere. I have this:
My form has fixed 14 rows table with header and footer. The cells of TimeIn and TimeOut columns are formated to HH:MM time fields. The cells of TimeWork column are TextFields. In TimeWork I calculate time like:
if(Table1.Row1.TimeIn.isNull or Table1.Row1.TimeOut.isNull) then
$ = ""
var startT = Time2Num(Table1.Row1.TimeIn.formattedValue, "HH:MM")
var endT = Time2Num(Table1.Row1.TimeOut.formattedValue, "HH:MM")
var differenceT = endT - startT
$ = Num2GMTime(differenceT + 1000, "HH:MM")
In the footer of the column TimeWork I would like to calculate total hours of that column and result should display in format HH:MM. How to get correct calculation result if total hours possible will be more than 24 hours?