2 Replies Latest reply on Nov 14, 2011 6:25 AM by RayCologon

    Time calculation


      I have a very easy question.

      I have three time fields indicating how long an exam in three parts last:

      Exam 01 (for instance it lasts 30 minutes: 00:30:00)

      Exam 02 (for instance it lasts 15 minutes: 00:15:00)

      Exam 03 (for instance it lasts 20 minutes: 00:20:00)


      i want to have another time field that calculates these three time fields. How do I get the result (65 minutes or 01:05:00)?
      Please help

      Thank you

        • 1. Re: Time calculation

          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

            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 ))



            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.".





            R J Cologon, Ph.D.

            FileMaker Certified Developer

            Author, FileMaker Pro 10 Bible

            NightWing Enterprises, Melbourne, Australia