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.

Featured Replies

Hi!

I'm using Windows 7 and Filemaker Pro 10 Advanced.

I'm having a field "Phone 1".

This field is for local Mobile Numbers (10 digits)

As someone enters a number XXXXXXXXXX, I want it to reformat automatically to XX XXXX XXXX.

What kind of calculation do I need to do... I'm brand new to calculations...

Thanks for all the help I can get!

/Fred

The calculation you are looking for may be something like this:

Case(

Length(Self) = 10;

Middle(Self; 1; 2) & " " &

Middle(Self; 3; 4) & " " &

Middle(Self; 7; 4);

Self

)

or even this if you want to handle a wider variety of input values consisting of 10 digits with arbitrary spacing:

Let(

theValue = Substitute(Self; " "; "");

Case(

Length(theValue) = 10;

Middle(theValue; 1; 2) & " " &

Middle(theValue; 3; 4) & " " &

Middle(theValue; 7; 4);

Self

)

)

Use this in the Auto-Enter Calculated value part of the field's definition. Uncheck the box for Do not replace existing value of field.

Edited by Guest
Providing two options for calculations

I would also recommend using the filter function.

Let(

theValue = filter (self; "1234567890");

Case(

Length(theValue) = 10;

Middle(theValue; 1; 2) & " " &

Middle(theValue; 3; 4) & " " &

Middle(theValue; 7; 4);

Self

)

)

Hmmm, you say you are using FM Pro Advanced but your profile shows FM Pro so I'll assume you have access to creating custom functions. I would suggest using this custom function by The Shadow here.

It covers all User possibilities and provides a visual format of what it should contain. If you want the format to display #### instead of underscore, check further up in the thread for another example by The Shadow where he formats with ###.

I believe this a bit faster:


Let(

theValue = Filter (Self; "1234567890");



Case(Length(theValue) = 10;



Replace(Replace ( theValue ; 3 ; 0 ; " " );8;0;" ");





Self

)

)

--sd

  • 2 weeks later...
  • Author

Thanks everyone!!

Create an account or sign in to comment

Important Information

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

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.