Rich S Posted September 14, 2009 Posted September 14, 2009 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!
comment Posted September 14, 2009 Posted September 14, 2009 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?
Rich S Posted September 14, 2009 Author Posted September 14, 2009 (edited) 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.) Edited September 14, 2009 by Guest
comment Posted September 14, 2009 Posted September 14, 2009 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.
Rich S Posted September 14, 2009 Author Posted September 14, 2009 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?
comment Posted September 14, 2009 Posted September 14, 2009 Well, if it's time, why not use a Time field?
Rich S Posted September 14, 2009 Author Posted September 14, 2009 ...'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.
comment Posted September 14, 2009 Posted September 14, 2009 Wouldn't formatting the field not to display the seconds do it?
Saubs Posted September 14, 2009 Posted September 14, 2009 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--
comment Posted September 15, 2009 Posted September 15, 2009 I'm afraid I don't understand the problem.
comment Posted September 15, 2009 Posted September 15, 2009 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now