John Mark Osborne Posted April 27, 2006 Posted April 27, 2006 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.
Newbies StarFangledNut Posted July 16, 2006 Newbies Posted July 16, 2006 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?
togo Posted October 11, 2006 Posted October 11, 2006 Hi Man, StarFangledNut I think whit a Filter. Fun :
aldipalo Posted November 2, 2006 Posted November 2, 2006 (edited) 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, 2006 by Guest tighten things up
Newbies bv2000 Posted November 7, 2006 Newbies Posted November 7, 2006 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.
Lee Smith Posted November 8, 2006 Posted November 8, 2006 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
RT Posted December 11, 2006 Posted December 11, 2006 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
Newbies François Sylvain Posted June 1, 2010 Newbies Posted June 1, 2010 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
Recommended Posts
This topic is 5287 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 accountSign in
Already have an account? Sign in here.
Sign In Now