Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So far in this title, we've been working with creating one record at a time, but the true value of a database is to store and manage a lot of data. The best way to get a large amount of data into your database at one shot is to import data from another source. We've already discussed creating a database from a spreadsheet, and even importing a spreadsheet into your database as a new table, but in this movie, we'll discuss just importing the data into your database. This will also allow us to work with large sets of data in some of the upcoming chapters. First, let's take a look at our Products layout.
You'll notice here in Products that we no longer have any data, even though when we first set up this file we imported not only the table and field definitions, but also its data. But for the sake of this exercise, we're going to work with an empty Products table. So, in order to bring data into this table, we're going to use a function that's called the Import function. The Import function can be found under the File menu by choosing File, then Import Records. FileMaker allows you to exchange information with other applications by exporting data from other file formats, then importing that data into FileMaker Pro.
So, here we're going to assume that we already have exported data from another data source. Most data applications will allow you to create data exports, so this is a pretty common function. So, what I'm going to do is choose File from the File > Import functions. We're going to choose the exercise folder 7/07_01. Now, you'll also notice, in the bottom left-hand corner, that you can choose from various different file format types. These are all the compatible import source formats. The most common are Comma-Separated Text, or a CSV file or, a Tab-Separated Text or a .TXT file.
Then of course, there's two options for Excel, either the older format of Excel or the newer XLSX format. If FileMaker Pro does not support the format of a particular application, you may still be able to convert that data by exporting data from that application into a format that FileMaker Pro supports, like one of these on this list. For example, FileMaker Pro does not import Microsoft Access files, but you can export the data from Microsoft Access into a format that FileMaker Pro does support, and then import that data into FileMaker Pro.
In this case, we're going to import data into an empty table, or the Products table, more specifically, and when importing, we should exercise more caution, as some of the Import options will overwrite existing data and cannot be undone. So, it's important first to pay attention to what layout you're on when you first invoke the Import dialog. Here, we've purposely chosen the Products layout, because it's based on the table, Products, that currently has no data. But if I was trying to import Products data, and I happen to be on the Customers layout, it's going to try to force that Product data into the Customer layout.
That's not the desired effect that we're going for here. So, step number one is pick the context or the layout that represents the table for which you're trying to import data. Then go under File > Import. Now we're going to choose the Products.csv, which is a Comma-Separated Text document, and we're going to hit Open. The first thing that you should know is that the source file you're selecting doesn't need to have the same number of fields, or have fields in the same order as the target file. It just needs to have the same type of data. So, in our case, this Comma- Separated File has fields created for all the different types of attributes for each product.
During this Import process, this Import Field Mapping window allows you to line up the different fields from your source with the appropriate destination fields inside of your target table. Let's open up this window just a tad, so we can see all the fields. You'll see here that we've got the source on the left-hand side, which is Products.csv, and then our destination table, which is going to be the target where all the data is going to go. You see that at this point, you can change to other tables, but right now we're going to stick with Products. On this screen, you have a couple of decisions that you need to make. The first one is that double-check to make sure that your Target table is correct before you proceed, and you can see here that we've got the correct one, Products, chosen.
Then you're going to see the two sets of fields, the one on the left, and the one on the right. At this point, you're going to have to line up the field, so that they actually match. One way you can start to line them up if you have similar field names is by using this dropdown menu in the bottom right-hand corner. You can choose last order, creation order, field names, for example. By choosing field names, you see that it's given us a little bit of a head start by lining up some of them with the data that might be in the right spot; however, you'll see some that do have the same name aren't lined up appropriately. That's what these little handles are for within FileMaker that allows to line up these fields to the right spot.
Only the fields in your Target side, or the right side, can be moved. So, in the case of Cost, we'll want to click on the Field and move the handles up, as you see in the blue highlight, to line up with the Cost field. There's a couple of other ones that would work in the same manner. Now, in some cases, you're going to be lining up fields that don't have names that match exactly. Like, for example, the fields in our Target file, called Unit Dimensions, is going to line up with the field from the Source, called Dimensions. You'll also notice that in this case, there isn't an arrow between the two fields.
An arrow indicates that we do want to move fields from the Source to the current table. If we uncheck the arrow, by simply clicking in between two fields, we'll see that that will omit them from the Import. So, once you're done lining up your desired fields, you'll want to select the values that you do want to import by making sure they have an arrow, and unchecking the items that do not. You'll also notice that some fields, like Extended Cost and Extended Price, don't have arrows next to them and show up in gray. That's because those are calculated fields that you cannot put data into, because they're evaluating data from various other fields, and you will always omit these from your Import.
As a matter of fact, if you try to include them, you'll see the arrow with the red line next to it, which as indicated down here below, means the Target cannot receive data into this field. So, we'll make sure that those are all turned off. Now, once you have all your fields lined up between the Source and the Target, you'll need to choose whether or not to import the first record. You'll see that option here in the bottom left-hand corner of your window, and you'll choose that option if the Source file uses the first record as column headers. Many times, you'll see this with spreadsheets that use the first row to identify what the column header names will be.
In our example, our first row is the column header information, so we do want to check this option, so that we don't import a record that has the words Dimension, or Description or Price inside the appropriate fields in our new product table. If you get all the way to this stage, and you realize that in your current table you don't have a field for you to be able to map up with one of the Source fields, you can always go down to the bottom right-hand corner and hit your Manage Database button, which will bring up the Manage Database and go right to Fields and allow you to create a new field. Once that new field is created, you'll see that on the Target Fields list, and then you can match up your Source field with the new field you've created.
This makes it so that you don't have to close out this window and start all over again, just because you've forgotten a field. Now we're ready to import, so we're going to hit the Import button. Before it proceeds with the import, you're going to see the Import Options window up here. The main decision to make here is on the top, whether or not to perform autoenter options while importing. If you recall when we discussed setting up autoenter options, anytime a new record is created, things like Date Created or serial values like Primary Keys can be automatically populated for every new record.
Since, in this case, we're actually going to be creating a new record in our database for every record that exists in the source, we have the option here to say whether or not our autoentry values should be triggered. In this example, we actually do want to check the box, so that our Primary Key values, or our _pkProductID values, will continue to serialize, and at the same time FileMaker's internal counter will be updated to the new serial value reflected by the total number of records we're importing into the Product table. After we hit Import, we then see something called the Import Summary.
This shows the total number of fields that were imported, or any errors that may have occurred. An error would indicate that it did not import a record, because one of the fields had violated a validation setting, for example, if you set up a field in your database, to only accept nonempty values into a Product Name field, then those records from your source will be skipped during the import if they do contain no value. However, if your Validation setting is set to Only during data entry, then they will be included in the import and will not show up as an error.
Once we dismiss this summary, we hit OK, and now we see that we've got 30 records in our new Products table. FileMaker not only added the new records, and lined up all the fields as we've instructed, but you can see here, it automatically created serial values for every product. If we go under the File > Manage > Database, double-click on the _pkProductID, we'll see that it's also updated the new value with the new number of records that are in our database. You'll also see that it's created what's called a Found Set that includes all of the records that we imported in.
This way, if we already had, let's say, a thousand records in the database, and we import in 30, it doesn't mix them with the general population of data until we get to approve them one last time. That way, we could go under Records > Delete Found Records, and delete the newly imported records, in case we've done something wrong during the import process. Now, we're going to do one more example of the imports to show a little different method. We'll do it a little bit quicker this time, File > Import Records, the same way as we had done before. This time, we're going to select FileMaker Pro Files, and we're going to choose a FileMaker file called Products_Plants.
I wanted to show you this option, because importing from other FileMaker databases where the fields match is a lot easier of a process. We simply then choose this matching names option, and all of the fields automatically sync up with their appropriate fields from the source. Now we hit Import, perform autoenter options again. And this time you'll see we have no errors, but ten new records were created, and the ten new records that were imported are isolated as a Found Set, giving us an opportunity to delete these records if we need to. The true value of a database is to store and manage as much data as you can, and the best way to get a large amount of data into your database at one time is to use the Import functionality.
Get unlimited access to all courses for just $25/month.Become a member
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.