9 Replies Latest reply on Jul 26, 2011 3:24 PM by TraceyAkin

    entering time

    TraceyAkin

      Title

      entering time

      Post

      Hi, I need to enter time without entering ":" or ".".  

      For instance want to be able to enter "07010000" and have it show as "07:01:00.00"

      In the past

      My field was set up as TiME

      Under Auto-Enter I checked calculated value and specified the calculation as

      //If(Get(RecordNumber)=1;Self; GetNthRecord(Start time;Get(RecordNumber)-1)+30)

      Let (

      [

      x = GetAsText( Self ) ;

      h = GetAsNumber ( Left ( x ; 2 ) ) ;

      m = GetAsNumber ( Middle ( x ; 3 ; 2 ) ) ;

      s = GetAsNumber ( Right ( x ; 2 ) )

      ] ;

      Time ( h ; m ; s )

      )

      I would then enter "070100" and it would show "07:01:00"  I can't figure out what to add to the formula so that I can enter the MS too.  Any suggestions on how to add the ".00" part to my time?

        • 1. Re: entering time
          philmodjunk

          FileMaker time fields measure time in seconds. They can't record fractions of a second.

          I think you'll need to store that info in a separate number field.

          You may want to enter the time into a text field and redirect the above calculation to extract the text to the left of the decimal from that field and convert it into time. A number field with an auto-entered calculation or a calculaiton field can then extract and store the last part of your time.

          • 2. Re: entering time
            TraceyAkin

            The research states that a time field is precise and that you can enter up to six digits to the right of the decimal point.  If can enter the time like I need it manually in a time field, why can't the calculation field be modified to include the decimal point?  

            • 3. Re: entering time
              philmodjunk

              My mistake. I see that "fractional seconds" can be entered here and that means that you can modify the calculation to include them.

              Let (

              [

              x = GetAsText( Self ) ;
              l = length ( x ) ;
              h = GetAsNumber ( Left ( x ; 2 ) ) ;
              m = GetAsNumber ( Middle ( x ; 3 ; 2 ) ) ;
              s = GetAsNumber ( Right ( x ; l - 4 ) )

              ] ;

              Time ( h ; m ; s )

              )

              • 4. Re: entering time
                TraceyAkin

                Thanks for looking at it again.  I pasted the calculation in and "specified field cannot be found" pops up.  The specified field is in the s =GetAsNumber ( Right ( x ; l - 4 ) ) part of the calculation, specifically the l is highlighted.  Thanks again for your help.  

                Let (

                [

                x = GetAsText( Self ) ;
                l = length ( x ) ;
                h = GetAsNumber ( Left ( x ; 2 ) ) ;
                m = GetAsNumber ( Middle ( x ; 3 ; 2 ) ) ;
                s = GetAsNumber ( Right ( x ; l - 4 ) )

                ] ;

                Time ( h ; m ; s )

                )

                • 5. Re: entering time
                  bumper

                  Must be hidden character or something in there. Just copy the calculation to TextEdit (mac) or similar for Windows and convert to plain text. Works fine after that. Or if you want to take it apart and kick the tires a bit, just recreate it with the native FMP functions.

                  • 6. Re: entering time
                    philmodjunk

                    It's supposed to be the same character as the variable assigned a value for the length of x as the second such variable declared insded the square brackets. If I'd used a capital L instead of lowercase it might have been less confusing:

                    Let (

                    [

                    x = GetAsText( Self ) ;
                    L = length ( x ) ;
                    h = GetAsNumber ( Left ( x ; 2 ) ) ;
                    m = GetAsNumber ( Middle ( x ; 3 ; 2 ) ) ;
                    s = GetAsNumber ( Right ( x ; L - 4 ) )

                    ] ;

                    Time ( h ; m ; s )

                    )

                    • 7. Re: entering time
                      TraceyAkin

                      Thanks to both of you for helping out. 

                      I have done what each of you suggested.  

                      I am getting the hh:mm:ss, now, but I am still not getting the .ms.  If I type in the .ms then the hh:mm:ss part is totally different than what I typed in.  

                      Is there a setting I am missing?  Could it be that I have not upgraded to FM Pro 11?  

                      • 8. Re: entering time
                        philmodjunk

                        It works for me and I don't think the difference in versions is an issue.

                        If I type in 052323.24, I get 05:23:23.24 returned as one would expect.

                        If you don't want to type in the decimal, we'll need to change the expression. (Interestingly, FileMaker doesn't have a data format for HHMMSS.dd. The only format that I can use to show the .24, is "As entered".

                        • 9. Re: entering time
                          TraceyAkin

                          I have it working now and showing what I want it to show.  Thank you so much.