My.ADVISOR.com Sign-In
ID
Password

Member Center / Sign-Up
   
SUBSCRIPTION STATUS
If you are a subscriber to this publication, sign-in to access locked articles. To subscribe or renew go to www.AdvisorStore.com.
Go to Article

ADVISOR ANSWERS

Validate Social Security Numbers

Make sure users enter the right number of numbers and that they don't enter any letters.

By Chris Moyer, Technical Editor and Bob Bowers, Contributing Editor

FileMaker Pro 5, 4.X, 3.X

Q: I need a quick and dirty method for forcing people to correctly enter Social Security numbers. I need to make sure they enter the right amount of numbers and that they don't enter any letters.
-Segenthaler Warfield, Atlanta, GA

A: Social Security numbers are kind of a classic. By the way, FileMaker Pro developer Rich Coulombre is fond of saying, "The federal government doesn't guarantee Social Security numbers to be unique human identifiers." In other words, two people can have the same Social Security number, so you shouldn't count on it for a primary key (aka unique record identifier) in your databases -- especially if you’re dealing with large populations of people.

To force people to enter values in a certain way, you need to use FileMaker’s validation feature. You might want to handle this a couple of different ways. If you just want people to enter numbers so you can use a calculation to add in the appropriate delimiters, you only need to validate for nine digits and no alphabetical characters. The calculation to verify the correct number of digits and the correct length is as follows:

(Length( SSN Entry) = 9) and (Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(SSN Entry, "0", ""), "1", ""), "2", ""), "3", ""), "4", ""), "5", ""), "6", ""), "7", ""), "8", ""), "9", "") = "")

This calculation first checks to see that the user entered only nine characters. Those nine characters could be letters, though, so the next part of the calculation checks to see that no letters have been entered. Because there isn’t any method of distinguishing letters from numbers, you need to use the process of elimination. By substituting blanks in for each number, you should be left with blank. If the result isn't "", that means a letter or some punctuation character was entered somewhere in the string. You might try creating a new calculation field and using the Substitute portion of the above calculation. You’ll see that if you type in 12345A67/, the result will be A/.

If you want users to enter delimiters with their entry, you need to validate for 11 characters, no alphabetical characters, and delimiters in the proper locations. Assuming your delimiters are "-", the calculation to validate on this scenario is:

(Length( SSN Entry) = 11) and (Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(SSN Entry, "0", ""), "1", ""), "2", ""), "3", ""), "4", ""), "5", ""), "6", ""), "7", ""), "8", ""), "9", "") = "--") and (Position(SSN Entry, "-", 1, 1) = 4) and (Position(SSN Entry, "-", 1, 2) = 7)

So you don’t confuse your users, you should enter a custom validation message such as:

The SSN must be in the following format:

XXX-XX-XXXX

...and it must contain only numbers, no letters.


For more Advisor Answers, visit http://www.Advisor.com/.

Printer-friendly
page layout

Validate Social Security Numbers

No reader comments ... yet.

    What do YOU think about this topic? Share your advice and thoughts using this form.

    Your Name

    REQUIRED : PUBLIC

    Your E-Mail

    REQUIRED : PRIVATE

    Job, Company

    OPTIONAL : PUBLIC

    City, State, Country

    OPTIONAL : PUBLIC

    Your Web Site

    OPTIONAL : PUBLIC

    Your Comment

    Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


    Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

    ARTICLE INFO

    FREE ACCESS FREE ACCESS

    Keyword Tags: Apple, Apple Mac OS, Application Design, Database, Database Development, FileMaker, FileMaker Development, FileMaker Pro, Microsoft Windows, Security, Software Development

    Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
    Portions copyright ©1983-2010 Advisor Media, LLC. All Rights Reserved.
    Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
    ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, LLC in the United States and/or other countries.
    Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
    Hosted by Prominic.NET Website powered by
    LOTUS SOFTWARE
    cf0006 MOYEC19X posted 2000-6-14 mod 03/20/2010 03:07:27 AM ztfmfd/ztfmfd
    domino-144.advisor.com my.advisor.com 03/20/2010 04:57:27 AM