Jump to content

format a field to display a telephone number


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

Recommended Posts

I thought I heard FMP7 has the ability to automatically format a field to display a 13 digit number into a telephone number: 444444333 into (444) 444-3333. Does it work, or not? And how do you do it?

Thanks!!!

FileMaker Version: 7

Platform: Mac OS X Panther

Link to comment
Share on other sites

  • Newbies

In FMP7, you can use the Auto-Enter Calculated value and unchecked "Do not replace existing value of field (if any)".

Put his formula in Specify for PhoneNumber [text] =

"(" & Left(PhoneNumber;3) & ")" & Middle(PhoneNumber;4;3) & "-" & Right(PhoneNumber;4).

Hope it helps

Link to comment
Share on other sites

Here's the formula I use to format the field: PHONE

It works around users who may not enter all the numbers ro dashes, or leave off an area code, or leaves it as entered if they've entered an extension or something else:

Case(Length(GetAsNumber( PHONE )) =10 ; "(" & Left(GetAsNumber( PHONE ); 3) & ") " & Middle(GetAsNumber( PHONE ); 4; 3) & "-" & Right(GetAsNumber( PHONE ); 4) ; Length(GetAsNumber( PHONE )) = 7; "(_______) " & Left(GetAsNumber( PHONE );3) & "-" & Right(GetAsNumber(phone); 4) ; PHONE )

I know I could have elimiated all the "GetAsNumber" by using the new "Filter" funtion, but my fingers are so used to typing in FMP6!

Link to comment
Share on other sites

Actually Bruce, rather than use the GetAsNumber( ) function *or* the filter function seven times, you'd have been better off using FileMaker 7's new Let( ) function, as it will result in a calc expression that will execute far more efficiently. Eg:

Let(X = GetAsNumber(Phone);

Case(Length(X) =10 ; "(" & Left(X; 3) & ") " & Middle(X; 4; 3) & "-" & Right(X; 4);

Length(X) = 7; "(___) " & Left(X);3) & "-" & Right(X; 4) ; Phone)

)

Link to comment
Share on other sites

This topic is 6502 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
 Share

×
×
  • Create New...

Important Information

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