PhoneFormatter ( FieldContents )
Formats any phone number to the North, Central and South American standards. It includes the special cases of México City, Guadalajara and Monterrey in México.
Average rating: 5.0 (1 vote) Log in to vote
Ibrahim Bittar Torres - Show more from this author
Eikonsys, S.A. de C.V.
PhoneFormatter ( "525587653798" ) = +52 (55) 8765.3798
PhoneFormatter ( "7653798" ) = 765.3798
PhoneFormatter ( "50687653798" ) = (506) 8765.3798 --> Costa Rican mobile phone number
PhoneFormatter ( "587653798" ) = (58) 765.3798
PhoneFormatter ( "57653798" ) = 5765.3798
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This calculation follows these steps:
1.- Take the input number and pads it with zeroes to make a 13 characters string.
2.- Then it divides it into four blocks:
Value1 = Country code
Value2 = Area code
Value3 = First block of the phone number
Block2 = Second block of the phone number
3.- IsCA is a flag to check if the phone number country code belongs to Central America.
4.- TheCountryCode is blank if the number belongs to Central America, otherwise it takes the numeric value of Value1.
5.- In México, area codes for México City (55-56), Guadalajara (33) and Monterrey (81) are 2 digits, followed by two 4-digit blocks.
6.- For the rest of cities in México and the rest of North America it follows the American Standard.
7.- For Chile the Area Code will be one digit only.
8.- For the rest of countries it will follow the North American standard.
You can take the "ThePhoneNumber" let parameter and change it as you wish. Please report any inconsistencies you may find and I'll update the CF as soon as I can.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.