Home > Articles

  • Print
  • + Share This
This chapter is from the book

Project: Setting Up Your First Database

We’ll be setting up a database in eight easy steps:

Steps

  1. Getting started
  2. Creating tables
  3. Creating fields
  4. Creating relationships
  5. Creating a layout
  6. Testing your solution
  7. Sharing FileMaker databases on a network
  8. Converting and normalizing a spreadsheet

Step 1: Getting Started

To begin, choose New Database from the File menu. Give it a name that makes sense.

Each of the projects in Part II has its own database requirements, so you need to know your way around the basics of the Define Database dialog (accessible from the File menu). It opens as soon as you have named your database.

A FileMaker database (starting with FileMaker 7) can contain a number of database tables. As with other relational database managers, FileMaker stores its data in tables that have rows and columns (sometimes called records and fields). A FileMaker database file can contain all of your solution’s tables or none of them. In addition to tables, a database file contains scripts, layouts, and security controls. These can apply to and be used by any of the tables in the database file. In addition, you can share database files and their tables.

Step 2: Creating Tables

By default, a single table is created in your new database file. Its name is the name of the database file. You can delete this table or rename it if you want to create a table with another name. The database file used in the first three chapters of this book contains two tables, shown in Figure 3.1. (The figures in this section show FileMaker Advanced. The buttons that enable you to copy, paste, and import tables are not available in FileMaker Pro.)

Figure 3.1

Figure 3.1 Create tables in the Define Database dialog.

Step 3: Creating Fields

To start creating fields, click the Fields tab in the Define Database dialog and select the table in which you want to create fields from the drop-down menu at the upper left of the window. Each field should have a meaningful name, and if there is any ambiguity, add a comment to the field name at the bottom of the window. Figure 3.2 shows the Fields tab in the Define Database dialog.

Figure 3.2

Figure 3.2 Define fields in your table.

Choose the type of field you want to use. A good rule of thumb is to choose the most specific type of field you can. If you are storing numbers in a field, FileMaker is able to convert the contents of a text field to numbers as needed, but you can’t apply numeric formatting to the text field. In order to use numeric formatting (as well as numeric validation for data entry), define numeric fields as numeric. Likewise, define dates as dates and times as times.

As shown in Figure 3.3, you can switch between the options for fields and their comments by clicking the header of the right column. You also can change the order in which fields are shown.

You will see how to use the types of fields in the later projects.

Step 4: Creating Relationships

Each table you have created is shown in the Relationships tab of the Define Database dialog, as you can see in Figure 3.4.

Figure 3.3

Figure 3.3 Add comments to field names where appropriate.

Figure 3.4

Figure 3.4 Use the Relationships tab to manage tables in your database.

Relationships are defined to link records in one table with records in another table; they are drawn as lines on the relationship graph shown in Figure 3.5. One of the most frequent reasons to do this is if the number of records in one table for a given entity differs from the number in another table. For example, you might have a table containing categories of items in a collection. Each category can have several inventory items associated with it. If you try to squeeze all of the inventory information into the categories table (perhaps as item1, item2, and so forth), you will encounter problems. Instead, the preferred method is to assign a unique ID to each category and to use it as the related field for a table containing inventory items. Each inventory item has a Category ID field that is related to the zID field in the category table. (The use of the name zID for ID fields is common; because the field is used internally, it is prefixed with z so it appears at the bottom of alphabetized field listings, below the more visible fields such as name, price, address, and so forth.)

By using this relationship, you are able to get from any given inventory item to the related category information (Category Name, for example). Relationships go in the other direction, too. From a given category you can get to that category’s inventory items. This is precisely the situation that will be explored in the Collections Database project in Chapter 5, "Managing One-to-Many Relationships." Figure 3.5 shows its relationship graph; as you can see, in addition to the tables in the relationship graph, there are now lines indicating the relationship.

Figure 3.5

Figure 3.5 Lines indicate relationships.

This structure can be replicated in many levels. For example, a category may have many inventory items, and an inventory item may belong to many categories. To implement this, you might have three tables that are related to one another:

  • zID in the Inventory table is related to Category ID in the Categories table as shown in Figure 3.5.
  • ID in the Categories table is related to Inventory ID in a new table called InventoriesAndCategories. This structure allows you to have many categories assigned to a single inventory item and many inventory items assigned to a category. This type of relationship is called a many-to-many relationship; it is the basis of the Boutique Manager project in Chapter 6, "Managing Many-to-Many Relationships."

As you will see, you implement these relationships by drawing lines from one table to another. Relationships can be quite complex; they need not be equal. You can have a relationship of all orders with balances over a certain amount; you can use dates as the basis of relationships. The projects in this book show a wide variety of relationships.

The process of organizing data into a set of related database tables is called normalization. Rules are available that can guide you through the process, but as you will see later, you can be guided just as easily by common sense and by making certain that your data is not duplicated. (The process of normalizing a spreadsheet is described in the "Converting and Normalizing a Spreadsheet" section later in this chapter.)

For now, you just need to know that you can create tables, fields, and relationships with the Define Database dialog and that you will use it in each of the projects of in this book.

Step 5: Creating a Layout

Your first layout needs to have data entry fields for the fields in your table. It is not hard to create the layout: FileMaker will do it by default. As soon as you have finished entering the names of your fields into the Define Database dialog, you will have a layout you can use to enter and display data.

Step 6: Testing your Solution

At every step of the development process, test your solution. Test it to see that it does what you want it to do. Then go back and test it to see if it fails properly. This is one of the most common problems: Your solution works right if you enter the right data, but sometimes you (or someone else) enter something that is wrong. Do you accommodate human frailty and data errors?

One tip for testing any software is to have someone else do the testing (just as you have someone else proofread what you have written).

Step 7: Sharing FileMaker Databases on a Network

Along with security, it is hard to retrofit networking and data sharing after you have designed a solution (this applies to any software, not just FileMaker solutions). If you are certain that your data will never be shared, you do not have to worry about networking. However, it is safest to consider the possibility of networking and data sharing so that, even if you do not need it now, you can use it in the future.

Three ways of sharing FileMaker databases on networks are

  • FileMaker sharing
  • FileMaker Server
  • Web sharing

Using FileMaker Sharing

If you have a network, you can share FileMaker databases over it. You can turn on sharing from one copy of FileMaker and connect to it from another copy of FileMaker on that network. Because you can locate FileMaker by using a network IP address, this sharing can even happen over the Internet, provided that you know the IP address of the computer on which FileMaker is running.

In order to connect to a shared database, use the Open Remote command from the File menu; you will see the copies of FileMaker that are sharing databases on your local network. You can also type in the IP address of a FileMaker computer that is not on your network.

This type of sharing is appropriate for a small number of users; the software limits that number to five.

Using FileMaker Server

For more than five users, you need to use FileMaker Server. This is software that runs on a computer (it need not be a specific server computer, but that is often preferred), and it does nothing except share FileMaker databases. It manages users, can control backups, and enables you to open and close databases. However, FileMaker Server does not enable you to create or edit databases as FileMaker Pro does.

FileMaker Server has no visible interface; you use FileMaker Server Admin to manage the FileMaker Server software. It is often desirable to install FileMaker Server Admin on one or more computers on a network other than the computer where FileMaker Server itself is running. That gives you access to FileMaker Server itself without needing to physically touch the server computer which might be locked away in a secure location.

Using the Web

You can share databases using Web technology. FileMaker supports Instant Web Publishing that puts your databases on the Web so you can use a web browser to access the databases. With Instant Web Publishing, what you see in a browser is very close to what people see using FileMaker itself as a client.

You can exert additional control over your web databases by using Custom Web Publishing with FileMaker Server Advanced, which relies on XML/XSLT, two industry-wide standards for web publication. Instant Web Publishing is discussed in Chapter 11, "Implementing a Simple Web Publishing Solution"; Custom Web Publishing is not.

Step 8: Converting and Normalizing a Spreadsheet

Here is a taste of a very small project that can get you started using the tools described in the three chapters of this part of the book. The process of building tables and relationships that is summarized here is explored in detail in the next three chapters.

Convert the Spreadsheet to FileMaker

As described in Chapter 1, a spreadsheet can be downloaded from the U.S. Census Bureau website; it contains population estimates through 2030 by age and sex for each state. It also contains 2000 actual population numbers by state for each age and sex.

To convert it to a FileMaker database, you can simply drag it onto the FileMaker icon. What you get is a database that contains the spreadsheet data. It looks like a spreadsheet, and, in Table view, it behaves like a spreadsheet.

Rename the Fields

In fact, the table that is created in this way is table File4 of the file File4 normalized.fp7 that is available on this book’s website. There is only one difference between table File4 and the table that is generated by the automatic conversion: The field names in the automatic conversion are named Field 1, Field 2, and so forth.

Open the Define Database dialog and change the names of the fields to more meaningful names. You can tell what they should be because the first few records of the converted file have headings that describe the columns. File4 normalized.fp7 has renamed fields in it. These are names such as Age, Census 2000, Projection 2004, Projection 2005, Region, Sex, and State.

Eliminate Unneeded Data

This step starts to clean up the data. Some blank lines are in the spreadsheet. In addition, there are totals. Those can be calculated easily by FileMaker. Using Find mode, find lines where Age is blank or contains the string Total. Delete these found records.

Normalize the Data

If you start to manipulate the data, you will see that it is awkward to work with the string of fields for each projected year. A lot of repeating data is in the database. Normalizing it as much as possible makes it easier to work with. Instead of putting all of the projections for a state, age, and sex together in one record, you can split up the record. Figure 3.4, shown previously in this chapter, shows the fields of a new table, Data4, that are normalized.

It is worth looking at each of these fields so you understand how normalization works. The idea is that each data element is a separate record. Thus, each record needs to be identified by the Age, Sex, and State fields. Another field, DataName, is used to indicate the year of the projection. Together, these four fields uniquely identify every number on the spreadsheet. (The table Data4 also contains some census identification—FIPS, Division, and Region—that are not needed in the example but have been preserved in the database.) In addition to the fields that identify a data value, you need the value itself—DataValue. This field is a numeric field, not a text field.

The last important field is a summary field, sDataValue. It is a summary that represents the total of all DataValue fields currently displayed. If you experiment with the database, you will see that selecting the records where DataValue contains the string 2000 gives you all of the actual 2000 census records, and the sDataValue field displays the total population of the United States according to the 2000 census.

Finally, there are five fields that many FileMaker database designers automatically add to every database table: Their names start with z (so they appear at the bottom of an alphabetized field list), and they contain timestamp and other information about the record. They can help with debugging. Throughout this book these are referred to as administrative fields, and they appear in almost every table. All are auto-entered by FileMaker, and the option is set to prevent modification by users. As a result, you can rely on these fields containing accurate data:

  • zID—Unique serial number generated by FileMaker
  • zCreator—User or FileMaker account name of the creator of the record
  • zCreationTS—Timestamp of creation
  • zModifer—User or FileMaker account name of the previous modifier
  • zModificationTS—Timestamp of previous modification

After you have the Data4 table created with these fields, you now need to create scripts to normalize the data. The scripts that do this were described in the preceding chapter, and they are provided in the file that you download from the website. You can now go back and see what happens as a long, unnormalized record containing projections for 2004 to 2030 is split into its component data values.

Make a copy of File4 normalized.fp7, and go to the layout that displays Data4 (the new table). From the Records menu, select Show All Records, and then, from the same menu, choose Delete All Records. Data4 is now empty, and you can run the script to convert all of the data. It takes a few minutes (but not many), and all the data is converted.

Experiment in finding all the data for a certain year, state, or sex. Look at the sDataValue display: If the numbers are strange, look for extraneous records. (For example, if they are too big, you have left fields with the total number of records in the database.)

This part of the book has reviewed the basics of FileMaker that you need for the later projects. You might need to look at some of the documentation again or explore the online help if you are uncertain about some areas. If you can work your way through the normalization process described in this section, you are ready to move on to the rest of the projects.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020