January 3, 200620 yr How do I fet a filter to work for phone numbers? IE: 555-555-1212 would convert to (555) 555-1212? I see Let(phone = filter(theField;"0123456789");"(" & left(phone;3) & ")" & middle(phone;4;3) & "-" & middle(phone;7;4)) But do not know how to get it to work. Thanks
January 3, 200620 yr The easiest way to use this formula is to create a custom_function out of it. Then on one of your fields that you want the formatting to occur, have it set to a calculated result with 'Do not replace...' unchecked. The calc forumla that you use would just be the custom_function applied to the field. There are also numerous other posts in regards to phone number formatting on these forums.
January 4, 200620 yr Author I defined the phone field to use the custom function, but then I get "this field is not modifiable" ;)
January 4, 200620 yr Don't use a regular calculation. Use a text field with an Auto-Entered Calculation (with the "Do not replace.." option unchecked.)
January 4, 200620 yr Author Ok I must be missing something. I did it and the function does not convert. The function I am using is: Let ( input = Filter (Phone ; "0123456789" ) ; Case ( input ; Case ( Length ( input ) = 7 ; Replace ( input ; 4 ; 0 ; "-" ) ; Length ( input ) = 10 ; Replace ( Replace ( Replace ( input ; 7 ; 0 ; "-" ) ; 4 ; 0 ; ") " ) ; 1 ; 0 ; "(" ) ; Length (input ) = 11 and Left ( input ; 1 ) = "1" ; Replace ( Replace ( Replace ( Right ( input ; 10 ) ; 7 ; 0 ; "-" ) ; 4 ; 0 ; ") " ) ; 1 ; 0 ; "(" ) ; input & TextColor ( " too few or too many digits" ; 16711680 ) ) ) )
January 4, 200620 yr Here is a sample file using a modified version of your sample code. Phone_sample.zip
Create an account or sign in to comment