Jump to content

This topic is 7036 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am attempting to use an auto enter replace existing values calculation to make entering data into a time field more efficient. I am trying to be able to enter numbers only without the :) and without am or pm in military time. I can enter in military time but have to use to :) and I am trying to skip that. So, I have develolped the following calculation but it doesn't seem to return the correct results. Can anyone find my error?

Case ( ApptTimeStart Calc ≥ 959 and ApptTimeStart Calc < 1200 ; Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 2) & ":" & Right(Digits; 2) & " am" ; ApptTimeStart Calc ≥ 1200 and ApptTimeStart Calc ≤ 1259 ; Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 2) & ":" & Right(Digits; 2) & " pm" ; ApptTimeStart Calc ≥ 1300; Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 2) & ":" & Right(Digits; 2) & " pm" ;Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 1) & ":" & Right(Digits; 2) & " am"))

Paul

Posted

Hi

the "error" was to try to enter "am" or "pm" into the field.

Also( but this isn't an error )you haven't to make so many "Let"... one is enough ! :)

Give a try to this calc:

_________________________________________________

Let([

Digits = Filter(ApptTimeStart Calc; "0123456789")

];

Case (

Length ( Digits ) = 1 ;Left(Digits; 1) & ":00" ;

Length ( Digits ) = 2 ;Left(Digits; 2) & ":00" ;

Length ( Digits ) = 3 ;Left(Digits; 1) & ":" & Right(Digits; 2) ;

Length ( Digits ) = 4 ;Left(Digits; 2) & ":" & Right(Digits; 2);

""

)

)

_________________________________________________

If you want to see the final result as:

12:23 pm you have to format, in layout mode, the field with your desired criteria in the menu Format-->Time...

Posted

Try:

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

Note:

Filemaker accepts military time entry - so there's no need to convert it to am/pm style.

Filemaker does NOT accept non-numeric characters in time fields (unless you are entering proper time, eg. "11:00 pm") - so there's no need to filter them out.

These two threads might be of interest:

http://www.fmforums.com/forum/showtopic.php?tid/163130/post/163131/#163131

http://www.fmforums.com/forum/showtopic.php?tid/149062/post/163951/#163951

This topic is 7036 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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