Importing Multiple Files from a Folder

FileMaker can import data from several files at once. In this batch mode, FileMaker takes the data from a file and imports it into one or more fields in a FileMaker table. FileMaker can also bring in information about each file's name and directory path.

FileMaker can work with two types of data when performing a folder import: image files and text files. In the case of image files, FileMaker can bring the image data from each file into a container field so that each image can be viewed inside FileMaker. In the case of text files, FileMaker brings the entire contents of the file into a specified text field.

Caution

FileMaker can store a maximum of 2GB of data in a single field. This may seem like a lot, and it is a lot compared to the limit of 64KB that was in force in previous versions of FileMaker! But it follows from this that you shouldn't import text or image files into FileMaker if any single imported file will be larger than 2GB.

 

Importing Text Files

Assume that you have a folder with a number of plain text files in it. Assume also that you have a FileMaker database that has a table in it with fields called TextContent, FileName, and FilePath. If you select File, Import Records, Folder, you'll see FileMaker's Folder of Files Import Options dialog box, shown in Figure 19.10.

Figure 19.10. FileMaker kicks off the Import From Folder process with a special initial dialog box.

In the upper area you can choose the folder from which to import data. You can also choose whether to confine the import to files at the first level inside the folder, or whether to drill into all the subfolders that might be below the top level.

After you've chosen a folder from which to import, choose the file type. To import from text files, choose the Text Files option and click Continue. You'll then see a folder import dialog box, similar but not identical to the regular Import Field Mapping dialog box, shown in Figure 19.11.

Figure 19.11. When importing from a folder of files, the source fields have a special name and meaning.

When you're doing a folder import, the names and contents of the source fields on the left are fixed: They depend on the type of file from which you're importing. When you're importing from text files, the source fields are called Text Content, File Name, and File Path. These fields contain, respectively, the actual text content of the field, the name of the individual file from which the data is coming, and the full name of the path to the file. As with any other data source, you can choose to import some or all of these fields, and you can choose how to map them to fields in the FileMaker table that's the target of the import.

Unlike imports from other kinds of flat-file data sources, FileMaker's batch text import brings the entire contents of each text file into a single FileMaker field.

After importing, you might have a data set that looks like the data seen in Figure 19.12.

Figure 19.12. This is a sample data set resulting from a batch import of three text files from a folder.

Determining File Type

When you choose to import files from a folder, FileMaker scans the files in the directory to determine which ones are of the right type to import. So for each file in the folder, FileMaker decides whether it's an image file (if you're importing images) or a text file (if you're importing text). But how does it make this determination?

If you're familiar with the way file types are handled in Mac OS X and Windows, you know that the file's suffix (.html, .jpeg, and so on) often has a lot to do with it. Often, applications use the file suffix to determine whether an application "owns" that file type and can try to open it.

FileMaker's batch import determines file type differently, depending on platform. On Mac OS X, FileMaker looks first at the file's type and creatorspecial information (also called metadata) that Mac OS X stores with each file. If a file has no type or creator (for example, if it was created on a nonMacintosh platform), FileMaker falls back on the file suffix.

Windows, by contrast, has no file type metadata, so FileMaker simply relies on the file suffix to determine whether a file is eligible for a batch import.

What this means is that FileMaker has no other innate intelligence about file types. If you take an image or PDF file in Windows and give it a .txt file suffix, FileMaker considers it eligible for a text import and tries to bring its content into a text field. Likewise, if you strip out file type and creator on the Mac and manipulate the suffix, it's possible to confuse FileMaker about the file type.

To see a file's type and creator in Mac OS X, if you have the Apple Developer Tools installed, you can use the command-line tool /Developer/Tools/GetFileInfo to see file metadata, and /Developer/Tools/SetFile to change the metadata. Or you can use a shareware tool such as Xray (http://www.brockerhoff.net/xray/).

 

Importing Image Files

Importing image files from a folder is quite similar to importing text files. See Figure 19.13 for a look at the folder-import options that apply to images. As with text files, you need to choose a source folder, and decide whether to drill down into any subfolders as well.

Figure 19.13. These are the special Import Field Mapping options for importing from a folder of images.

 

Images or References?

In the past, FileMaker's usefulness as a tool for storing entire files (sometimes referred to as asset management) was somewhat limited by the 2GB maximum size of an individual FileMaker file. With FileMaker 7, the file size limit is reckoned in terabytes, so it's tempting to try to use FileMaker as a tool for managing large amounts of nonFileMaker data such as image files.

Still, image data can take up a great deal of storage space, and it may not make sense to try to store thousands of high-resolution images inside a FileMaker file. Accordingly, FileMaker offers you the option (when importing images from a folder), to import only a reference to each file, rather than the entire contents of the image. If you choose to import a reference, FileMaker remembers where the image is stored on disk, and refers to it when necessary in a fashion similar to the way in which Mac OS and Windows work with shortcuts and aliases.

There are some additional considerations when using container fields in conjunction with FileMaker's Instant Web Publishing: see "Container Fields," p. 607.

The benefit of storing references is, of course, that they take up much less space in the database. The disadvantage is that if the original files are moved or renamed in any way, FileMaker will no longer be able to find them, and the images will not display in FileMaker nor be otherwise usable.

This is especially problematic if the file containing the images is hosted for multiuser access. Each user of the system needs to see the image directory via the same network path. Because Windows and Macintosh handle server paths differently, creating a unified server structure to work in both environments could be challenging.

In the end, the decision as to whether to import whole image files or just references is up to you, keeping in mind the tradeoff between the flexibility of having all images stored directly in the database, versus the increased capacity that comes from working with the file references alone.

Images Versus Thumbnails

When you import data from text files, you can bring in up to three pieces of data: the filename, the full path to the file, and the text contents of the file. With image files, it is possible to bring in four pieces of data. As with text files, you can bring in the filename and file path. You can bring in the full contents of the image file (into a container field, presumably), and you can also bring in a smaller version of the image if you choose, called a thumbnail. See Figure 19.12, shown previously, for a possible import configuration for a batch import of images.

Naturally, a full-sized image can take a lot of space, so FileMaker gives you the option of bringing in only a smaller thumbnail instead. You can bring in the thumbnail in addition to the larger image, or instead of it. (Of course, you could choose to import just the filename and path if that suited your purpose.)

Tip

FileMaker doesn't give you any control over how it creates thumbnails during the image import process. You may find that although you do want to store only a smaller copy of the image in the database, FileMaker's thumbnail process doesn't give you what you want. You might want the thumbnails a little smaller or larger, or with some kind of color adjustment. If so, you will want to experiment with creating your own thumbnails first, and import those instead.

Manipulating Images

With a tool such as Adobe Photoshop, it's possible to create batch-processing scripts (called actions in Photoshop) that can apply a series of transformations to every image in a folder. You might want to create an action to shrink every image to 120 pixels wide, 72 dots per inch, and save it as a high-quality JPEG with a two-pixel black border. You could then batch-import the resulting custom thumbnails. In doing so, you'd want to make sure to import the image data rather than the thumbnail data: If you asked FileMaker for the thumbnail data, your classy custom thumbnails would be further scrunched down into thumbnails of thumbnailsprobably not the desired effect.


Importing Photos from a Digital Camera

Part I: Getting Started with FileMaker 8

FileMaker Overview

Using FileMaker Pro

Defining and Working with Fields

Working with Layouts

Part II: Developing Solutions with FileMaker

Relational Database Design

Working with Multiple Tables

Working with Relationships

Getting Started with Calculations

Getting Started with Scripting

Getting Started with Reporting

Part III: Developer Techniques

Developing for Multiuser Deployment

Implementing Security

Advanced Interface Techniques

Advanced Calculation Techniques

Advanced Scripting Techniques

Advanced Portal Techniques

Debugging and Troubleshooting

Converting Systems from Previous Versions of FileMaker Pro

Part IV: Data Integration and Publishing

Importing Data into FileMaker Pro

Exporting Data from FileMaker

Instant Web Publishing

FileMaker and Web Services

Custom Web Publishing

Part V: Deploying a FileMaker Solution

Deploying and Extending FileMaker

FileMaker Server and Server Advanced

FileMaker Mobile

Documenting Your FileMaker Solutions



Using FileMaker 8
Special Edition Using FileMaker 8
ISBN: 0789735121
EAN: 2147483647
Year: 2007
Pages: 296

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net