Skip 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.

Scripting Problems with phone number

Featured Replies

I found out recently that you can't make custom scripts with FM Pro 8.5, because I don't have Advanced. So now I am stumped. All I am trying to do is what would seem (and I don't understand why it's not standard) to be easy is make a phone number field that automatically seperates the area code and puts the dash in. I have several scripts, but since I don't have adavanced I can't use them. Somebody please help me.

I think you are confusing "Custom Functions" which is only available in Advanced. However you can create a :):phonefield (Text Field)and have an autoenter calculation:

Case(Length(Phone) = 7;Left(Phone;3) & "-" & Right(Phone;4); (Length(Phone) = 10); "(" & Left(Phone;3) & ") " & Middle(Phone; 4; 3) & "-" & Right(Phone;4);"error")

"Phone" is the name of your Phone Number field.

This calculation requires you enter the data as numbers only 2127894563 returns 212-789-456. If the user enters the number any other way you will get an error. Also, if the data already exists you will need to re-enter the data to get the proper result unless you check "Do not replace existing data if any." However, you will then have whatever garbage is already in there remain.

HTH

Al

Here's a formula that will allow your users to enter a phone number with any formatting they want. The formula will remove the formatting and then format it the way you want. You can combine it with the formula from aldipalo to test for 10 or 7 digits numbers. You can download the example file with the link below:

http://www.filemakerpros.com/FieldFilter7.zip

Hi John Mark:

So I use this custom function:

Case(

Length(Phone Number) = 7;Left(Phone Number;3) & "-" & Right(Phone Number;4);

(Length(Phone Number) = 10); "(" & Left(Phone Number;3) & ") " & Middle(Phone Number; 4; 3) & "-" & Right(Phone Number;4);

(Length(Phone Number) >10) and Left (Phone Number ;3)="011";Left(Phone Number;3) & "-" & Middle(Phone Number; 4; 2) & "-" & Middle(Phone Number; 6; 3)& "-" & Middle(Phone Number; 9; 3) & "-" & Right(Phone Number;4);

"Re-enter in number format")

where do I put the Filter piece?

Al

Hi aldipalo:

... where do I put the Filter piece?Al

By implementing the Let function. Your Case statement would then reside in the calculation body of the Let statement. If you haven't yet worked with Let statements, check out John Mark's calculations in the attachment above. They're one of my favorite features to come out of FM7.

Looks like ThatOneGuy has pointed you in the right direction.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.