AnsweredAssumed Answered

Phone number formatting

Question asked by RickWhitelaw on Nov 25, 2009
Latest reply on Nov 25, 2009 by comment_1

Title

Phone number formatting

Post

I use an auto-enter calculation in a phone number field that's stored as text:

 

Case(  Length ( Filter (Self ; "0123456789" ) )   < 10  and Left ( Self ; 1 ) ≠ "+"; "Enter 10 digits!";Length ( Filter (Self ; "0123456789" ) )   = 10; "(" &  Left ( Filter ( Self; "0123456789" ) ; 3 ) & ") " & 

Middle ( Filter ( Self; "0123456789" ) ; 4 ; 3 ) & "-" & Right ( Filter ( Self; "0123456789" )  ; 4 );Self) 

 

 It works fine and properly formats phone numbers no matter how the user enters it and allows for International numbers to remain unchanged (some are 9 or 12 -digit codes). I'd like to be able to save and call it as a custom function. The "Self" function, however, can't be used in a custom function. I've tried replacing "Self" with "Get(ActiveFieldContents)" and that doesn't work. Ideas?

Outcomes