dbTalk Databases Forums  

Phone number format

comp.databases.filemaker comp.databases.filemaker


Discuss Phone number format in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
JoL
 
Posts: n/a

Default Phone number format - 12-17-2005 , 05:17 PM






Access calls it a "mask" but in Filemaker8, is it possible to format
a field to make phone numbers appear with parenthesis and hyphen in
place like (123) 456-7890?

Reply With Quote
  #2  
Old   
Matt Wills
 
Posts: n/a

Default Re: Phone number format - 12-17-2005 , 05:40 PM






JoL wrote:

Quote:
Access calls it a "mask" but in Filemaker8, is it possible to format
a field to make phone numbers appear with parenthesis and hyphen in
place like (123) 456-7890?
This calculation comes from the custom functions library at
BrianDunning.com. You can use it as an Auto-Enter calculation for your
phone number field. In the second line, change YourFieldName to match
the actual field name being re-calculated.

It re-formats into a 333-333-4444 arrangement, assuming any additional
characters are an extension.

If there are too few characters, it formats the text in red.

This one does not insert parentheses, but a with a little fiddling, you
can see how to do that on your own, if you find that construct
absolutely necessary.

Matt

The calculation:

//Strip non-Numerics
Let( [TempNum= Filter( YourFieldName ; "0123456789");

//Remove leading 1
Num = If( Left(TempNum;1) = 1; Middle(TempNum;2;99);TempNum);

Phone =

// Test for empty Number
If( Length (Num) < 1; "" ;

//Otherwise...
Left (Num ; 3) & "-" & Middle(Num;4;3) & "-"& Middle(Num;7;4) &

// if longer than 7 characters assume it is an extension
If(Length(Num)> 10; " x" & Middle(Num;11;99);""))];

// if shorter than 7 characters display it in red as error
If(Length ( Num ) < 10;
TextColor ( phone ; RGB ( 255 ; 0 ; 0 ) );
// remove color format
TextColor ( phone ; RGB (0 ; 0 ; 0 ))))


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.