Re: Phone number format
- From: "Matt Wills" <Im@xxxxxxxx>
- Date: Sat, 17 Dec 2005 23:40:05 GMT
JoL wrote:
> 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 ))))
.
Relevant Pages
- Re: OT: Why do so many forms require numbers be entered without hyphens or spaces?
... Because computers are supposed to serve human beings, ... These are typically stored in databases without any of the extraneous characters. ... Different countries have different formats for phones - and typically like to see the phone numbers in their own format, not a string of numbers or the U.S. format. ... If a program requires its users to input data in a form other than the formthose userare accustomed to using, and cannot perform such simple adaptations as stripping out common punctuation characters, then that program has been incompetently designed and coded. ... (comp.lang.php) - Re: OT: Why do so many forms require numbers be entered without hyphens or spaces?
... Because computers are supposed to serve human beings, ... These are typically stored in databases without any of the extraneous characters. ... Massively missing the point, which is that the person visiting the page neither knows nor cares, and should not NEED to know or care, what format the ... Computers should adapt to us, ... (comp.lang.php) - Re: A C showstopper
... format to storage, sprintf has a built in danger that as far as I know ... The C99 solution (limit the number of characters) is extraordinarily ... its contract is to always allocate enough ... (comp.lang.c) - Re: Form Protection with Excel Object Embedded
... the best field to base the calculation on might be the one in the example titled 'Calculate the # Days Difference ... The date input format is of no consequence, provided both dates have a day, month and year- you might want to enforce this via the ... Excel workbook, though. ... At most, you'll need to insert a paragraph break immediately before the workbook, then format the workbook ... (microsoft.public.word.application.errors) - Re: Nmea 0183 question
... Sentence format is NMEA 0183. ... WeatherStation PB100 is predicted to operate on Windows OS via USB port. ... I have connected station to the serial port on my PC and i used HyperTerminal ... HyperTerminal i get whole bunch of puzzling characters as you can see on the link below: ... (sci.geo.satellite-nav) |
|