April 3, 200421 yr I thought I heard FMP7 has the ability to automatically format a field to display a 13 digit number into a telephone number: 444444333 into (444) 444-3333. Does it work, or not? And how do you do it? Thanks!!! FileMaker Version: 7 Platform: Mac OS X Panther
April 3, 200421 yr The calculation field is utilized. c_telephone_number -> Calculation[text] = Substitute( telephone number ; ["-" ; ""] ; ["(" ; ""] ; [")" ; ""] ) Please download and check a sample. http://www.ne.jp/asahi/office/momo/upfiles/TelNo.ZIP Field c_telephone_number is used when searching a telephone number. Does it become helpful?
April 3, 200421 yr Newbies In FMP7, you can use the Auto-Enter Calculated value and unchecked "Do not replace existing value of field (if any)". Put his formula in Specify for PhoneNumber [text] = "(" & Left(PhoneNumber;3) & ")" & Middle(PhoneNumber;4;3) & "-" & Right(PhoneNumber;4). Hope it helps
April 3, 200421 yr Here's the formula I use to format the field: PHONE It works around users who may not enter all the numbers ro dashes, or leave off an area code, or leaves it as entered if they've entered an extension or something else: Case(Length(GetAsNumber( PHONE )) =10 ; "(" & Left(GetAsNumber( PHONE ); 3) & ") " & Middle(GetAsNumber( PHONE ); 4; 3) & "-" & Right(GetAsNumber( PHONE ); 4) ; Length(GetAsNumber( PHONE )) = 7; "(_______) " & Left(GetAsNumber( PHONE );3) & "-" & Right(GetAsNumber(phone); 4) ; PHONE ) I know I could have elimiated all the "GetAsNumber" by using the new "Filter" funtion, but my fingers are so used to typing in FMP6!
April 3, 200421 yr Actually Bruce, rather than use the GetAsNumber( ) function *or* the filter function seven times, you'd have been better off using FileMaker 7's new Let( ) function, as it will result in a calc expression that will execute far more efficiently. Eg: Let(X = GetAsNumber(Phone); Case(Length(X) =10 ; "(" & Left(X; 3) & ") " & Middle(X; 4; 3) & "-" & Right(X; 4); Length(X) = 7; "(___) " & Left(X);3) & "-" & Right(X; 4) ; Phone) )
Create an account or sign in to comment