Defining and Working with Fields
In this chapter
- Working Under the Hood
- Working with Fields
- Working with Field Types
- Assigning Field Options
- FileMaker Extra: Indexing in FileMaker Pro 7
Working Under the Hood
Fields are the heart of any database. By storing information in properly categorized fields, you impart both function and meaning to what would otherwise be an incomprehensible pile of raw data.
We'll spend much of this chapter describing what kinds of fields exist in FileMaker Pro, how they store information, and how to ensure proper data integrity in your database solutions.
If you're new to development in FileMaker Pro, this chapter is a good place to start. No doubt some of the topics we cover will lack a certain context, but establishing a solid foundation in field definition is a vital part of becoming a practiced developer.
If you have built a few FileMaker Pro databases, you may need to only skim this chapter. Of the topics we cover, indexing is likely the most advanced; our discussion explores some subtle differences from prior versions of FileMaker Pro.
New Databases Begin with Field Definitions
To create a new database, simply launch FileMaker Pro and then choose File, New Database. You'll be presented with the option to start with a template or to create a new, empty file. To create a file of your own, select the Create A New Empty File option and click Okay.
After you've stepped through these first tasks, you'll be taken to the Define Fields dialog.
If you don't want to see this dialog every time you create a new database, click the No Longer Show This Dialog check box. Subsequently, selecting File, New Database takes you directly to a New File dialog.
Working with Templates
We recommend that you go back at some point and work with FileMaker's built-in templates. They're a good learning tool, and you will be able to see how fields are defined in these finished solutions. There are dozens of them, they're not all that complicated, and they'll give you some good ideas for designing your own solutions. From them you can learn about simple user interfaces and calculation functions and can see some basic scripts in action.
Using the Define Database Dialog
When you choose to start on a new, empty database, FileMaker Pro creates a file for you and automatically opens the Define Database dialog (shown in Figure 3.1). As a developer, you'll spend a good bit of time in the three tabs in this dialog. FileMaker Pro's Define Database dialog allows you to create the fields, tables, and relationships you need to form your database. It also enables you to modify a wide range of attributes associated with fields, such as auto-entry functions, validation, storage, and calculation formulas. It is these elements that comprise a database's "structure" or "schema." It is here where you form your database behind the scenes.
Figure 3.1 The three tabs allow you to switch between defining fields, tables, or relationships.
Notice the active table in Figure 3.1: The fields you define are associated with this selected table.
FileMaker Pro will have already created a default table for you, named the same as the file itself. Notice the Table menu selection on the Fields tab of the dialog in Figure 3.1. Any fields you create will then be created in that table.
For some basic information on tables, see "Tables."
For a detailed discussion of multiple-table solutions, see Chapter 6, "Working with Multiple Tables."
Notice the third tab in the Define Database dialog: Relationships. We won't be covering multi-table relational databases in this chapter, but it is on that tab that you'd create the relational associations between tables in your solution.
For information on relational data modeling, see Chapter 5, "Relational Database Design."
Commenting is a vital discipline to develop. Spending a few moments to add information to the Comment text box, below the field name, as you create something will save time later in trying to figure out what you were thinking at the time.
To view comments, toggle between options and comments at the top of your field list.