Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need auto-formatting of Time entered in a field

Featured Replies

Greets, all:

Admittedly, I'm in Dense mode: I want a user to be able to enter a string of numbers for the time, e.g., 123, and have it auto-corrected in a Text field to 1:23...or 1028 would auto-correct to 10:28. Simple enough, right? But nooooooooo...no matter how much I've played with the Left, Middle, and Right commands I can't put a simple calc together to make it work since we're talking three or four digits, here. So I need your help.

Now, I thought setting the Field Type to Time instead of Text, but after playing with the settings for that in the Format menu I wasn't getting anywhere. So, am I missing something with Time field type or...?

Good thing I'm not a drinking man. Ciao!

Try:

Replace ( Right ( "0000" & Self ; 4 ) ; 3 ; 0 ; ":" )

I want a user to be able to enter a string of numbers for the time, e.g., 123, and have it auto-corrected in a Text field

Why in a Text field?

  • Author

Thank you!

That's just it: I tried the Time field type but when I entered 930 into the field, FMP changed it to 6:00 with the following settings. (See attached.)

time.png

Edited by Guest

when I entered 930 into the field, FMP changed it to 6:00

Yes, because by default, when you enter an integer it is assumed to mean the number of hours. The display setting has very little to do with the data and data entry - the actual time stored in the field is 930:00:00 (you can see this if you change the display to 24 hour). 930/24 = 38.75, so what you see is 6:00 PM on day 39.

  • Author

Ah! Thank you for the education!

So, now you have me curious about your question of why am I using a Text field; what did you have in mind?

Well, if it's time, why not use a Time field?

  • Author

...'cause *blush* I'd have to ask for another fix since, when I use your graciously-provided formula in a Time field, I get the seconds as well, so if I enter 930 it becomes 9:30:00; I still need to truncate it to 9:30.

Wouldn't formatting the field not to display the seconds do it?

Your formula works well, but I can't specify AM or PM; FileMaker's field validation jumps in when it sees a non-numeric character. Other than entering a 4-digit (24-hour) time value, is there a way to incorporate AM/PM in your formula?

Many thanks--

  • Author

Nope, unfortunately.

I'm afraid I don't understand the problem.

is there a way to incorporate AM/PM in your formula?

I don't think so. The problem here is that Filemaker's behavior is inconsistent: some formulas manage to evaluate before validation, some don't - although both return the same result.

You could add a button to toggle AM/PM or - if using version 10 - forget about auto-enter and use script trigger instead.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.