FileMaker Pro Function Review—Auto-Enter Serial Number
You may have previously seen our blog posts that focused on reviewing FileMaker Pro functions. We have decided to turn this into a series that will post on a bi-weekly basis. These function posts are targeted to our beginner FileMaker friends, but anyone interested in refreshing their knowledge on the various functions of FileMaker can benefit from this series.
We recommend you know the following to get the most out of this week’s post.
- How to place a field on a layout
- Familiarity with the FileMaker interface
- Starter Files (if you would like to follow along)
About: Auto Entry Into Fields
It is useful for certain fields to be automatically populated with default data when a user creates a new record. In this blog post, we review the option to set up a field with a serial number.
About: Serial Numbers
FileMaker Pro can insert a serial number into a field each time a new record is created or committed. This is primarily used for creating a primary key—a value that uniquely identifies each record—for that table. For example, in this post we use serial numbers to identify each one of our Contacts entered into our Contact Details layout.
Let’s get started
FileMaker Pro and FileMaker Pro Advanced come with the option to create a new database from a “Starter Solution”. The starter solution I have chosen for this post can be accessed from the menu bar. (File > New from Starter Solution… > Contacts)
*FYI: This starter contact solution has only one (1) table. This is also referred to as a flat database file.
In the Contacts solution, I have added a field to the Contact Details layout. This field already exists in the Contacts database and is called Contact ID Matching Field. I have placed it above the title field. You may place it anywhere.
For this post, I applied Conditional Formatting to make the field appear red for easier identification. You do not have to do this. The Contact ID Matching Field can be located in Figure 1.1: Starter File above the Title field on the layout.
Note that we have created a new record for John Doe and the associated CONTACT ID MATCHING FIELD was automatically assigned a value of 1. That value of one (1) is the serial number for John Doe’s record. Create a new contact record using your own information or feel free to use the information presented in Figure 1.1.
How This Field Was Set-Up? Let’s explore.
Access the settings or options for the “CONTACT ID MATCHING FIELD”. This can be done through managing the database of the solution. (File > Manage > Database…) When we explore the file using manage database, we find that our auto-enter serial number has a field name of “CONTACT ID MATCHING FIELD”.
*FYI: In future posts we will explore how this field is used to match other fields in a database with more than one table, referred to as a relational database file.
Locate and select the CONTACT ID MATCHING FIELD in the Contacts Table. Once selected, your screen should match what you see below in Figure 1.2.
Now, select the “Options…” button. A screen like the one in Figure 1.3 should open. This is where the options for the field are set. Go to the Auto-Enter tab. Note in Figure 1.3 where Serial number is selected. This field is set up to create a serial number only with the creation of a new record. The serial number will increase by increments of 1. Make sure your settings match the ones presented in Figure 1.3.
[space]Now, go to the Validation tab. Note Figure 1.4 and the settings selected. In this example, a serial number can only be validated during data entry.
[space]Click ok to exit the Options for Field window. Click ok to exit the “Manage Database for Contacts”. As you create new records you will be able to see the serial numbers assigned to each contact. Their value should increase by 1 upon each new creation.
We have set up an auto enter serial number on creation that will serve to identify that record. In this example, the serial number “1” will identify John Doe even in the event John Doe is deleted.
Those are the basic settings for the function Auto Enter Serial Number. Now you have the knowledge to set up your own Auto Enter Serial Number fields into future databases.
Look for the next FileMaker Pro Function Review in two weeks!
FileMaker 13/12 Certified Developer
The Scarpetta Group, Inc.