Posted on 2004-08-23
Last Modified: 2012-05-05
What function or script I should use for special fields such as phone numbers , social sec numbers.


If I enter phone number    5593512032 in a phone number field, when  I move to next record or exit  then the phone number field should appear as  (559)- 351-2032 or 559-351-2032  and same thing with Socaial Secuirty field  if I enter 603456743 after moving to next record or exiting the last field ( Social secuirty field )should appear as 603-45-6743.

Any suggestions. Help please !!


Question by:gurshaan

Accepted Solution

prifre earned 43 total points
ID: 11878426
Actually this is not so easy. The reason is that FileMaker does not enable you to automatically run a script (that would fix a field contents) after the data have been entered an fix it.

You could use a calculated field that takes the result from the first entered field, and calculates that one so the result looks nice in the calculated field and then just use the Calculated field when displaying the Phone.

Another difference is to enter them in an ugly way and then to manually start a script that would go through all the ugly phone numbers/socnumbers and fix them to be pretty. But that would mean you would have to edit them as pretty and they would be permanent in that field.

Another solution is to use FileMaker only as an engine and to handle everything through serverscripting and via a web-page. But that is something completely different.

So to sum it up - it is not really possible to do it perfectly (display something formatted, but edit unformatted) based on scripting, since FileMaker cannot do that well.
But you can get it nice via buttons and caculated fields when you actually need it (when printing, etc).

hope that helps
with a smile
LVL 28

Assisted Solution

lesouef earned 41 total points
ID: 11886010
I use RunScript.fmx which is a free plug-in which allows to trigger a script when you tab to next field, or click outside it.
So write the formatting script, and trigger it with that stuff. Absolutely magic!
Since I don't remember when I got it from, here is copy:

prifre: try it also, you'll like it.
LVL 19

Assisted Solution

billmercer earned 41 total points
ID: 11893984
Lack of good input masks and field formats is probably my biggest gripe about Filemaker. To get the visual effect you describe, this technique works pretty well. This example is for a 10 digit US phone number field called PHONE.

- Create an unstored calculated field called PhoneFmt, make it equal to
"(" & Left(PHONE,3) & ")" & Middle(PHONE,4,3) & "-" & Right(PHONE,4)
- Add this new field to your data entry layout.
- Set the background color of PhoneFmt to the same color as your layout's background.
- In the properties for PhoneFmt, uncheck the "Allow entry into field" option.
- Place the calculated field on top of the original phone number field so it covers it completely.  
Now, when you look at the layout you only see the formatted field that can't be edited. But if you click on it, it highlights the editable field underneath, which then becomes visible. Edit the number, and when you leave the field, the formatted calculation pops on top again, showing the formatted change.
Once you've created this on your layout, group the elements so you can move it around easily.

The hardest part of this is defining the calculation to do the formatting. Hi Voltage has a free plugin that makes this super-easy. If you download it, they also include a sample database that uses the same technique I described above. 

P.S. lesouef, thanks for the scripting plugin. I love stuff like that!
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

LVL 28

Expert Comment

ID: 11894228
I forgot to mention how it works:
You should use the external function
EXTERNAL("FMcs-CallScript", "[script name]")
in the 'control by calculation' property of the field.
(Names may be wrong, I have the same pb as prifre, not using an english version.)
It does nothing if the field is entered but left unchanged.
LVL 19

Expert Comment

ID: 12203801
Split it.
LVL 28

Expert Comment

ID: 12204490

Author Comment

ID: 13636701
Thanks Guys

I will try all of the options. You guys been very helpful.

Thanks again

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FilemaKER Advanced Server 12 15 792
Filemaker 13 Export / Import Records 1 1,002
FileMaker Pro 10 webviewer cache error 3 98
FFmpeg : cut starting 10 sec and ending 10 sec 5 61
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question