Validation Options - File Maker

This is a good point to explain the field validation options that are available because we want to add some validation to CompanyName. Double-click CompanyName and go to the Validation options tab, which looks like this:

Validation Options

Check the Not empty and Unique checkboxes. Now you’ll find out what field validation is, and what all options are available.

Field validation is a way for you to automatically “error check” someone’s data entry in order to make sure that data is entered into a field in the way that you want it entered. For instance, you might want to make sure that a phone number field always has 12 characters in it, including the dashes between the area code and prefix, and between the phone prefix and the last four digits of the phone number. Or, you might want to make sure that data in a field falls between a specific range (like “on a scale from 1 to 10 . . .”). Or you could make sure users only enter dates in a date field that are later than yesterday. In the case of our CompanyName field, we’d like to make sure that, for every record in Company.fp5, the company record has a unique company name entered into it.

This is actually two different types of validation working together; one checks to see that CompanyName field isn’t empty, and the other checks to see that what is entered into CompanyName is unique as compared to all the other CompanyName values in Company.fp5. Continue to study the above illustration as we discuss available validation options.

Field validation can be strict or not. In other words, if the validation on a field fails while a user is entering data, you can either immediately give the user a warning, allowing them to choose whether or not they want to leave the “invalid” data in the field or correct it, or, you can alert the user that they cannot continue doing anything else in the database system until they enter data in the current field that is valid. See the Strict option at the bottom of the following list for more on this.

Strict Data Type
By checking this box and selecting something from the drop-down menu, you can ensure that data entered into a particular field is of a specific type. For instance, you can make sure that a field, whether a text or number field, contains only numbers (Numeric Only). Or you can make sure that data in a field is a date with a four-digit year, in the remote case you still have Y2K concerns or deal with date ranges across several centuries (4-Digit Year Date). And if you select Time of Day, FileMaker will make sure that the data entered into a field is a valid time of day between 00:00 and 23:59, seconds being optional.

Not Empty
You just used this type of validation for CompanyName. It makes sure that the field in question is not left blank on any new record.

You’re also employing this type of validation on CompanyName. It means that every entry in CompanyName across all records in Company.fp5 is unique. Thus, there can never be two (or more) “Chris’s Grocery”s, for instance.

Using this type of validation means that any entry made into a field must match a value already entered in that field in existing records. So if you have two records in your database, and the Color field in these records has “red” and “white” in them, respectively, a third record created would have to have “red” or “white” entered in its Color field as well. You could not enter “blue,” as this is not a preexisting value in that field in that database.

Member of Value List
You haven’t learned about value lists yet, but you probably know what they are. A value list is basically a preset selection of values that a user can choose among when entering data, usually from a menu or even from checkboxes or radio buttons. For example, you might set up a value list in Company.fp5 on the State field for the 50 states. Then, whenever a user tabs or clicks into the State field, they’re presented with a quick list of all 50 two-letter state codes and don’t have to remember whether Nebraska is NE or NB. Anyhow, to validate against a value list, you are saying, “The value in this field is only valid if the value entered exists in my x value list.”

In Range
By filling values in the from and to boxes to the right of In Range, you are saying that an entry into the field at hand is only valid when it falls between the starting and ending values that you enter. Therefore, if you set a range of one through ten for a number field, a user can enter 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10. If you set a range of A through Z for a text field, a user can enter anything that’s alphabetically in that range. You can have time or date ranges as well.

Validated by Calculation
Calculation fields will be discussed shortly, but with calculated validation you have the free-form ability to invent your own formula for what valid data entry is and what isn’t. For instance, if you have a field called Due Date and you want to make sure that the date entered there is always the first day of the month, you would validate against a calculation defined as:


If the data entered into Date is valid (like “10/1/2002” would be because it’s the first of day of the month of October, 2002), FileMaker internally will return a Boolean value of either one, which means “True,” signifying that the data entered is valid, or zero (or “False”), meaning the data entered is invalid. While you’re learning, you may want to actually write the validation calculation out in “long hand,” showing the Boolean values that can be returned, as such:


which validates the exact same way as the first bit of code, except that it spells out the internal Boolean values of one or zero that can be returned when the validation either succeeds or fails.

While you are specifying the calculation formula to validate against, there is a checkbox in the Specify Calculation window called Validate only if the field has been modified, which means basically what is says: If the box is checked, the validity of a field’s contents will be verified only when you change the contents of the field. If the box is unchecked, the validation will occur every time you exit the record, regardless of whether you’ve changed any data in the field or the field is even on the current layout.

Maximum Number of Characters
Selecting this form of validation allows you to limit the number of characters a user can enter into a field. For instance, you can set a social security number field to allow only nine characters so that a user must enter just the nine digits of someone’s SSN and omit any dashes and spaces. You can also limit a zip code field to five characters. Remember, there is a limit to the range of values that may be entered into any field anyway: A text field can have 1 to 64,000 characters, a number field 1 to 255 characters, a time field 1 to 255 characters, and a date field 1 to 10 characters. So, for example, setting a maximum length of a date field as 11 is not possible.

The next two validation options have to do with what you want to happen when validation fails (a user has not entered valid data into the field).

Strict: Do Not Allow User to Override Data Validation
You learned about this earlier. If Strict is not checked, a user will be warned that the data they enter is invalid and given the option to either accept the invalid entry, reject the invalid entry, or revert the field to its previous contents prior to the entry of the invalid data. If Strict is checked, the users get the same warning,only they are not allowed to leave the invalid data as is in the field. They must revert to the previous contents or reject the invalid entry outright.

Display Custom Message if Validation Fails
If validation for a field fails and this box is not checked, the user will get a generic warning telling them about the invalid data entry. If this box is checked and you’ve entered a custom message in the message box, the user will get your custom message when validation of the field data fails.

A few points need to be made about validation before you move on:

  • You can validate data only in text, number, date, time, or container fields.
  • Date and time fields are validated by FileMaker regardless of what validation options you’ve created. That is to say, you always have to enter a valid date into a date field and time into a time field. But more extensive validation can be set up for date and time fields, as explained above.
  • Auto-entered data in a field is never validated because FileMaker assumes that when you set up auto-enter options for a field, you know that auto entered data will be valid. So if you’ve got a field set to auto-enter the word “hot” and validation by calculation that says all values in the field must be “cold” in order to be valid, the validation will not fail when you create a new record.
  • Validation options of Unique and Existing do not take into account the case (upper, lower, or title case) of data in a field or any punctuation marks.

Therefore, “ACME Corp.” and “a.c.m.e. CORP” are not unique entries, and any Unique validation in this case would fail.

Let’s go ahead and, for the CompanyName field, check the Strict. . . box and the Custom Message checkbox. Then, enter the custom message of “You must enter a unique company name for each customer.” Click OK to exit field validation options.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

File Maker Topics