Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

PhoneFormat(Phone; Format)

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 3.7  (54 votes)
  Discuss this Custom Function

John Mark Osborne, Database Pros
http://www.databasepros.com/

Dynamically formats phone numbers

Sample Input:
PhoneFormat("909-393-4664"; "(###) ###-####")
Sample Output:
(909) 393-4664


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

A recursive phone format formula can adapt to any length phone number and any format style. Call the custom function from an auto-enter calculation to format your phone numbers when exiting the phone field. Make sure to uncheck the option to "do not replace existing value (if any)".

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

I had the problem that fields that had been edited would get the formatting characters added by default even though the fields appeared "empty" on screen.

I added an "IsEmpty" test for this great function. Copied below:

/*

PhoneFormat(Phone; Format) by John Mark Osborne, Database Pros http://www.databasepros.com/

Dynamically formats phone numbers

A recursive phone format formula can adapt to any length phone number and any format style. Call the custom function from an auto-enter calculation to format your phone numbers when exiting the phone field. Make sure to uncheck the option to "do not replace existing value (if any)".

Modified by Paul N. Lawrence December 1, 2013 to detect the empty field condition so formatting text characters are not entered automatically.

*/

Case( // added by Paul N. Lawrence December 1, 2013

not IsEmpty(Phone); // added by Paul N. Lawrence December 1, 2013

Let(

[NumbersOnly = Filter(Phone; "0123456789");
NewNumber = Right(NumbersOnly; Length(NumbersOnly) - 1);
NewFormat = Right(Format; Length(Format) - 1)];

Case(

not IsEmpty(Format);

Case(
Left(Format; 1) = "#";
Left(NumbersOnly; 1) & PhoneFormat(NewNumber; NewFormat);
Left(Format; 1) & PhoneFormat(NumbersOnly; NewFormat)
)

)

)

) // added by Paul N. Lawrence December 1, 2013

Paul N. Lawrence, Texas
December 01, 2013 10:29am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 5 + 1 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions