Jump to content

Auto enter (/) slashes or (-) dashes on date field


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

Recommended Posts

Hi, I was wondering in Filemaker 7 if there is a way that the slashes or dashes be put in place as the user enters eight digits in a field. I.E. as I input 03 than a slash appears automacatelly then input 26 then another slash then input 2005.

Thanks in advance.

Link to comment
Share on other sites

you could have the data entry field be a text field, auto-enter by calculation, replaces existing value, with the calculation being:

Left ( field; 2 ) & "/" & Middle ( field ; 3 ; 2 ) & "/" & Middle ( field ; 5 ; Length ( field ) - 4 )

but if the user did put the dashes or slashes in, you'd get odd results, so this would be better:

Let (

[ text = Substitute ( Substitute ( field ; "/" ; "" ) ; "-" ; "" ) ] ;

Left ( text; 2 ) & "/" & Middle ( text ; 3 ; 2 ) & "/" & Middle ( text ; 5 ; Length ( text ) - 4 ) )

You could validate length being 8, but since it does the auto-enter before the validation, you'd have to take the inserted dashes or slashes into account, so similarly, the validation calculation could be:

Let (

[ text = Substitute ( Substitute ( field ; "/" ; "" ) ; "-" ; "" ) ] ;

Length ( text ) = 8 )

Then if you needed the result as a date, have another calculation field, date = GetAsDate (field) on which you do whatever date calculations or scripts, or whatever.

Link to comment
Share on other sites

This topic is 7017 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.