Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Any database system that you create really should strive to have consistent data. Without data consistency, it becomes extremely difficult, if not impossible, to derive meaningful and viable information about whatever the database is designed to keep track of. So even in your best efforts to create a good architecture, if you're not managing the types of data that are going into the database, you might have some problems with some of the results you're getting out of the database. So to ensure that data is entered into your database in a consistent and reliable manner, you must design checks and restrictions on the way that users are allowed to enter data in the system.
This is where another field option called Field Validation comes into play. Field Validation, which can be found under the File > Manage > Database Window, clicking on any field, and choosing Options, you'll notice that in the Field options, you've got a Validation tab. Field Validation allows you to test field data against specific criteria, and possibly even warn the user if the value doesn't pass muster in some way. So, for example, you can use your field validation to make sure that a price that was entered is greater than 0, or make sure that a ZIP code field is not empty, those types of things.
You might be familiar with this type of experience as a user, whether you're using database system or even making orders online. If you forget to put in a ZIP code field, the database that runs a Web site, for example, will come back and tell you, oops! You've forgotten that. Can you make sure to add a value before we let you proceed? As you'll learn later in this movie, if a user tries to commit a record containing field data that violates the validation rules, a user is going to receive a warning, and be prompted to change the nonconforming data; thus, keeping your data consistent and reliable. They will be frozen in time, not allowed to move forward or backward without addressing the violation of the data.
Of course, this can be somewhat of a hindrance to data entry, so you have to make these Validation Option selections very carefully. So let's do an example here. If we went into the AddressEmail, and let's say it's very important for you to communicate with your users via e-mail, and that every time that they order from you, you send them a confirmation e -mail that they need to reply to. So in that case, you've got a business rule that says we need to have a customer's e-mail in order to be able to complete this workflow. So if we double-click on AddressEmail, or we can select it and hit Options, either one of those two ways, it'll bring our Field Options window forward.
You can select the Validation tab, and beginning at the very top of the dialog, we can see that we've got a couple of decisions that we need to make. First, you'll see Validate this field Always or Only during data entry. The Only during data entry is of course the default. When you create a new field, it means that the validation that you select, if you select any, will occur only when a user manually enters data into the fields. There are other types of ways that you can get data into the field, such as scripts or even importing data into your database, but if you have Only during data entry selected, those other ways will be a mute.
This is a default setting, because it's more common that you want to control how human beings, or your users, are entering data, rather than other technical mechanisms like importing or scripts. So, for example, let's say that anytime someone's data entering a customer record, I want to make sure that they gather the e-mail. But let's say I've got a huge database of leads that I got from a conference, and I just want to import those into my database. Those might not be customers yet, so I don't necessarily need their e-mail until we start to engage them. So in that example, I do want to bring records into my database through an import.
But when a user gets to it, and I want to make sure that the user is alerted that we don't have an e-mail. So conversely, choosing Always means that whatever rules we apply inside the Validation tab will always have to take place, or the record won't be allowed to be added, or the data won't be allowed to be added if it violates muster. This is a very strict level of Field Validation, and you should use caution when you're choosing Always. We'll keep this one on the default, data entry. For the sake of the AddressEmail option, we're going to leave it as Only during data entry, because we may want to import customer records from other sources that don't have e-mails, similar to the example that we just discussed.
An additional check box in the upper section of the dialog also allows you to choose whether or not the user can override data entry. So you see that this is also kind of a soft sort of reminder that there's a rule about the data in the field. If that's checked, that means that the user can choose to ignore it; however, if you uncheck it, that means they have no choice but to comply before they can proceed on with their activity. They could, of course, just delete the record they're working on, but they won't be able to create a record, and ignore your field validation. So now in the central section you'll see that we've got the various different choices that we have to apply validation to a field.
These validation rule options that you see here are not mutually exclusive, meaning that you can pick more than one, and therefore have various different rules that the data will have to pass in order to be added into the database; however, some of them really don't make sense to choose both at the same time, so FileMaker won't allow you to do that. For example, choosing Unique or Existing, it's only going to allow you to choose either/or because those conflict with each other and it doesn't really make sense. However, if I say, Not empty and Existing, it will allow me to do that. You'll also notice that Strict data type > Numeric; I can only choose one of those rather than multiples.
So under Strict data type, I can say, this field must only have numeric data entered, a 4 digit year date or be a time of day. As we saw here, I can check Not empty, which is what we want to do in this case, or choose from either a Unique value or Existing value. These are probably the most common settings that you may have inside of FileMaker. Member of a value list ensures that the field value that you're trying to enter into the field also exists in a value list somewhere within our database. Later on in this movie, we'll show you how to create value lists, and this is just a number of one of the useful ways that you can use those value lists once created.
In range is pretty self-explanatory. It gives you two entry boxes, and whatever the data that you enter in must fall within the range, whether your field is a number field or a date field, it will be able to determine whether or not the date falls within the range or a numerical value falls within the range. Validate by calculation is very popular; however, it's going to require an understanding of the calculation dialog and functions which we'll be covering later on in this title, and we're even going to use the Validate by calculation option as a demonstration to show how those work. So now finally, we're just going to leave the AddressEmail validation settings to Not empty.
We'll hit OK, and hit OK again. Now, let's create a new record. When we try to commit the record, you see when we get this message, "AddressEmail" is defined to require a value, and you must enter a value. So until we enter something into this field, it's not going to let us pass, but one thing that you'll notice is that that message is a little bit nondescript. So there's something that we can do about that if we need to. First, we'll enter a value to let us move on.
We'll go to Manage > Database, under the File menu, and go to AddressEmail and double-click on it, and you'll see we've got Not empty chosen. But if you notice down below, we can choose to Display a custom message, should the validation be violated. So in this case, we can do something a little bit more user-friendly, like "You must enter an e-mail before proceeding." Now, when we hit OK, and OK, and try to create a new record, you see that it's a little bit more user-friendly of a dialog than the other message that popped up earlier.
One important thing. Since we're going to be using this database for our various other exercises, we don't want the users to have the same experience where they keep seeing this message. So we're going to just delete a record, we're going to go under File > Manage > Database, and we're going to turn off the Required, and we're going to turn off the Not empty. This way it won't be a hindrance to us when we're doing other exercises. But you notice though, that by deleting the record, it doesn't require us to enter a value, and that's because FileMaker doesn't care if you're deleting a record, because that data is not going to violate the rules that it had set up for the data that's already storing.
FileMaker Field Validation allows you to test data against specific criteria to warn your users if a field value does not pass muster in some way, thus allowing you to keep your data consistent and reliable. All are keys to having an effective storage mechanism inside your FileMaker database.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 69958 Viewers
80 Video lessons · 127380 Viewers
52 Video lessons · 62336 Viewers
59 Video lessons · 48031 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.