phone.format ( Phone ; Format )
Format a phone number with format
Average rating: 4.6 (31 votes) Log in to vote
phone.format ("55b51.2-12" ; "### (###) ###-####" );
phone.format ("8005551212" ; "### (###) ###-####" );
phone.format ("18005551212" ; "### (###) ###-####" );
1 (800) 555-1212
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
// Will format the number according to the given format.
// Fills in the format from right to left and if the number
// is longer than the format, the extra numbers will be
// prepended to the front of the formatted phone number.
// Any non-numeric characters in the phone number are ignored.
Oct 2, 2012
|thanks will try this one.|
|Chuck, North Carolina
Feb 5, 2013
|I am very new to FM12 (FileMaker, too) This is exactly what I have been struggling with....where do I find FileMaker Advanced's Edit Custom Function window?|
Feb 6, 2013
|Chuck : Go to "File" then "Manage" then "Custom Functions"|
Aug 18, 2015
|i get invalid parameter for "Phone"|
|Jenn, Fullerton, CA
Apr 7, 2016
|To Jared or anyone else, if you haven't figured it out yet, all calculations have parameters, that's the part within the parentheses... For example: Count (field), the parameter for the Count Function is "field". To simplify the above custom function, since I myself am pretty new to filemaker, and I'm not really sure about the format parameter above, let's just consider you want to make sure all phone numbers are formatted as such: (xxx)xxx-xxxx. In this case you just need one parameter "Text". I made my own custom function to mess around and prep to try and get certified ( which again only focuses on formatting like so: (xxx)xxx-xxxx.)it is as follows:
I entered the Edit Custom Function dialog, named the function "PhoneFormatting" and added a Function Parameter simply called "Text" (press green button to add) then the calculation was simply
"(" & Left(text;3) & ")" & Middle(text; 4;3) & "-" & Right(text;4)
Enter Manage database, pick the field you would like to apply custom function to, in my case the field was Cell_Phone, select Auto-enter calculation, enter PhoneFormatting (Text) and replace Text with the Cell_Phone field. You can also use "Self" if you prefer. For added security I added strict numeric data only under validation and a custom message if the user enters anything other than numeric values that stays "Please enter numbers only with no formatting."
This will not reformat populated fields, but if you're new to the game, hope that helps! :-)
|Armen, Los Angeles/CA
Aug 16, 2016
|Thank you for providing this code. What would be required to include an extension?|
|Hans, Spartanburg, SC
Sep 27, 2016
|I get "An operator is expected here" on the first parenthesis after phone.format
phone.format ( NewNumber ; NewFormat ) & Right ( JustNumbers ; 1 ) ;
Also phone.format flagged as no function so i added it to the list.
any advice would be greatly appreciated.
Dec 28, 2016
|I'm not sure how to change the custom function based on the parameters for the phone number. Can someone send me a sample function that is clear where to place the parameters?
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.