Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Field Calculation for Phone #'s

Featured Replies

I'm new to FileMaker. What is the field calculation for automatic correction of a phone number?

For example, if a user enters the phone # 0123456879. I want the field to automatically adjust the numbers with the parentheses around the area code w/ 1 space after the parentheses.

Here what I want it to look like (012) 345-6789. I want the field to automatically update entries to look like that.

Thanks!

The built-in manual/"FMP Help" states:

The following example removes all text from the provided data, then formats the remaining numbers in the preferred phone number formatting:

Let(phone = filter(theField;"0123456789");"(" & left(phone;3) &

")" & middle(phone;4;3) & "-" & middle(phone;7;4))

If theField contains Work: 408.555.1212 this calculation returns (408)555-1212.

Hope that helps.

  • Author

I have extensions for some of them.

So I actually want it to look like this

(012) 345-6789 ext. 123. If there is an extension.

Are they always 3 digit extensions?

If so this should work fine.

/* Strips out any not numeric characters then;

Takes a 7 digit phone number and formats it as (918) xxx-xxxx [color:red](918) is our local area code

Takes a 10 digit phone number and formats it as (xxx) xxx-xxxx

Takes a 13 digit phone number and formats it as (xxx) xxx-xxxx ext. xxx

[color:blue]phone_number is my field name

*/

Let ( digits = Filter ( [color:blue]phone_number ; "0123456789" );

Case (

Length ( digits ) = 7;

("([color:red]918) " & Left ( digits; 3 ) & "-" & Right ( digits ; 4 ));

Length ( digits ) = 10 ;

("(" & Left ( digits; 3 ) & ") " & Middle ( digits; 4 ;3 ) & "-" & Right ( digits ; 4 ));

Length (digits) = 13

("(" & Left ( digits; 3 ) & ") " & Middle ( digits; 4 ;3 ) & "-" & Middle (digits; 7; 4) " ext. " & Right ( digits ; 3 ));

Length ( digits ) = 0 ;

("") ))

I think thats right!

[color:green]ALSO...IN CASE NO ONE HAS MENTIONED IT...

SET THE CALC UP AS AN AUTO-ENTER CALCULATED VALUE AND UNCHECK THE "DO NOT REPLACE EXISTING VALUE FOR FIELD"

Edited by Guest
CLARIFICATION

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.