
1. Re: Time calculation
emilio_speciale Nov 14, 2011 4:48 AM (in response to emilio_speciale)Thank for your quick answer! fantastic.
But... it does not work!
I have 3 fields that are Time Fields and the 4th which is a calculation field: I copyed your formula and changed the names of the field.
Now I have set the 4th field in data formatting as you said as hhmmss, separator Symbol . (dot), 24 hour (empty trailing), leading characters for hour Zero, for minutes and seconds Zero.
Still I get a ? in the 4th field (the calculation). What is wrong?
Thanks again

2. Re: Time calculation
RayCologon Nov 14, 2011 6:25 AM (in response to emilio_speciale)pixi wrote:
assuming your "Exam 01" fields are "Time" fields the "Exam Sum" could be calculated this way:
GetAsNumber ( GetAsTime ( Exam 01 )) +
GetAsNumber ( GetAsTime ( Exam 02 )) +
GetAsNumber ( GetAsTime ( Exam 03 ))
...etc
While that formula should produce a time result that matches what Emilio requires, most of the code is actually redundant (ie, you can get there a fair bit more simply than that).
The GetAsTime( ) functions aren't needed because the original fields are already time fields, so the data is already being supplied as time. Similarly, the GetAsNumber( ) functions aren't needed, because time values are stored as numeric values within FileMaker (ie representing the number of seconds), and can be added or otherwise manipulated arithmetically without being converted to numbers first.
So in fact, the required result can be achieved using a time calc with the formula:
Exam01 + Exam02 + Exam03
I've attached a quick example that shows this working. In the example, I've provided two calculation fields  one configured to produce the result as time, and with appropriate field data mask settings to have the result appear in the format "01:05:00", as mentioned in the opening post. The other field uses a slightly different calculation expression to return the result as text in the format "65 min.".
Regards,
Ray

R J Cologon, Ph.D.
FileMaker Certified Developer
Author, FileMaker Pro 10 Bible
NightWing Enterprises, Melbourne, Australia
http://www.nightwingenterprises.com


TimeCalculation.fp7.zip 6.5 K
