April 27, 200619 yr Name & Parameters: [color:red][big] PhoneFormat ( Phone ; Format ) [/big] Description: The Format parameter, enclosed in quotes, can be changed to any series of pound signs (representing numbers) and other characters for separators. Any length phone number or format can be used due to the nature of the recursive custom function allowing a single calculation to format international and domestic numbers. Even numbers with extensions can be used. Sample Input: 9093934664 Results: (909) 393-4664 Recursive: yes Formula: Case( not IsEmpty(Format); Let( [ NumbersOnly = Filter (Phone; "0123456789"); NewFormat = Left(Format; Length(Format) - 1); NewNumber = Left(NumbersOnly; Length(NumbersOnly) - 1) ]; Case( Right(Format; 1) = "#"; PhoneFormat(NewNumber; NewFormat) & Right(NumbersOnly; 1); PhoneFormat(NumbersOnly; NewFormat) & Right(Format; 1) ) ) ) Required Functions: Author(s) John Mark Osborne Date: 04/27/06 Credits: John Mark Osborne Disclaimer: FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.
July 16, 200619 yr Newbies When I use this script, the formatting characters, such as '(', ')', and '-' are replaced with the letter 't'. I've tried several options, including using the backslash before the formatting characers, but nothing seems to work. Any ideas?
November 2, 200619 yr I don't know what I'm doing wrong here but when I try to save the CF I get "There are too few parameters" error message at the areas marked in red. Also are the Function Parameters those marked in Blue? Case( not IsEmpty([color:blue]Format); Let( [color:blue]NumbersOnly = Filter ([color:blue]Phone; "0123456789"); [color:blue]NewFormat = Left(Format; Length(Format) - 1); [color:blue]NewNumber = Left(NumbersOnly; Length(NumbersOnly) - 1) ]; [NewFormat = Left(Format; Length(Format) - 1); NewNumber = Left(NumbersOnly; Length(NumbersOnly) - 1) ]; Case( Right(Format; 1) = "#"; PhoneFormat(NewNumber; NewFormat[color:red]) & Right(NumbersOnly; 1[color:red]); PhoneFormat(NumbersOnly; NewFormat) & Right(Format; 1[color:red]) [color:red]) [color:red]) [color:red]) Edited November 2, 200619 yr by Guest tighten things up
November 7, 200619 yr Newbies I have a database of about 20,000 records I just imported from a .dbf file. I need to have the phone fields show up as (xxx)xxx-xxxx. I have the formula that will work with all new entries, but how do i get it to work on the 20,000 records i just imported. I have tried to write a script, but have been unsuccessful so far.
November 8, 200619 yr If your field type is Text, and you are using the Auto Enter Option with a Calculation, then Change the field to a calculation. Close the Define Field Box, FileMaker will update the field, and then you can go back into Defind Fields and change it back to Text. This isn't the case, please let me know more about the field involved. Lee
December 11, 200619 yr Hello i have inserted the custom function in to define/custom functions and all was accepted, but i do not know how to get it to work, i guess i click my telephone fields and then what sorry for such a noob question
June 1, 201015 yr Newbies Hi all, M. Osborne's solution is working very well .. but I have a problem with "() -" on the field when phone number field is empty I create the zip attach .fp7 file. This file need, at least, FM10 to work. As you will see, phone formatting is dynamic and formatting is done as soon user enter a number. Each number entered by user is followed by an automatic formatting. But the solution is very "big" .. it need 2 fields and 1 complicated script. Is there a easier solution to have dynamic and real time phone format formatting on FileMaker ? Thanks ! François Test_PhoneFormat.fp7.zip
Create an account or sign in to comment