frondoc picture

This page is
part of the
Frontier 4 site.

Frontier 5
shipped in
January 1998.

The information
on these pages
may not be
accurate for
Frontier 5.

These pages
are maintained
for archival
purposes only.

FileMaker and Frontier

How to bring the power of Filemaker databases to your scripting projects.

by Preston Holmes,; and Brent Simmons,

Frontier provides an excellent way to work with and manage data stored in FileMaker databases. FileMaker provides a great container to store your information, and Frontier gives you a powerful way to find, sort, add to, and extract that information.

Why FileMaker?

Frontier itself is a database which can store a great variety of data, and is already integrated with your scripts. Included with Frontier is uBASE, which provides a fast and simple database designed for the scripter. So with these tools available what does FileMaker bring to the table?

FileMaker is Fast

FileMaker was designed for searching and/or sorting large amounts of information very quickly. Its built-in indexing features let you search even very large amounts of text blazingly fast, and since it is PowerPC native, PowerPC owners benefit from accelerated performance.

It's on Your Desktop

Chances are, if you're a Macintosh user with an existing database, it's a FileMaker database. FileMaker has been a staple of Macintosh database users for a long time, thus there is a great deal of valuable information already in FileMaker databases. Frontier gives you powerful ways to access that information.

FileMaker is Relational

With version 3, Claris made FileMaker Pro a relational database, offering greater flexibility. Frontier provides complete access to the relational capabilities of FileMaker's new power.

FileMaker Uses Layouts

There is a good chance that non-Frontier users will have to interact with a given database. Even for experienced script writers, FileMaker's layouts provide a convenient way of adding, editing, and viewing the data in your database. Unlike uBASE, FileMaker is not 'for scripters only': much of its enduring popularity is due to its flexible and appealing user interface.

Determining whether to use Frontier, uBASE, or FileMaker will depend on the particular task at hand. You can always use Frontier to move information from one to the other.

Learning to use FileMaker with Frontier

Frontier is useful for automating the process of adding or extracting data from your FileMaker databases. You might import your mail from Eudora into FileMaker, or take information from FileMaker and use it to draw graphs using clip2gif, and yes, you can publish your data on the Web with FileMaker and Frontier.

To script FileMaker with Frontier, you first have to understand FileMaker and the components of FileMaker that are scriptable.

If you don't understand the basics of a database, the nature of records and cells, the best thing to do is work through the relevant chapters of the FileMaker manual.

The same way that you view a FileMaker database as a set of windows, fields, and records -- Frontier sees these as a set of scriptable objects.

FileMaker uses Apple's Object Model to provide its scriptability. Frontier provides complete support for the Object Model style of scripting applications.

Claris provides an excellent Apple Event reference for FileMaker. A version is included with the FileMaker installation, but a more up to date version is available on the web. Pointers for these resources are at the bottom of this page.

In order to refer to objects correctly you need to understand the way that different FileMaker objects are nested within each other. For instance: a database contains records, and records contain cells. This is FileMaker's 'containment', or 'object,' hierarchy. You can study this in Claris' reference or in Frontier at apps.FileMaker.objectHierarchy.

Claris' Apple Event reference can be used as both a manual and a reference. It is important to read the the sections that describe how certain ObjectModel objects relate to elements that you might be familiar with as a FileMaker user. For example, FileMaker's 'document' object refers to the current found set while the 'database' object refers to the entire database.

Writing the scripts

Although the best way to learn the detailed syntax for FileMaker scripts is to read through the Claris document and then the examples in "apps.FileMaker.examples," lets work through a basic example:

with objectModel, FileMaker,

	delete (request [all])

	create (request, {"Ben","Frank"})

	find ()

	sort (document [1], field [2])

	local (foundSet)

	foundSet = get (document [1].record [all])

This example searches a database of first and last names, sorts the found set by last name, and then retrieves the results.

Let's break this down:

with ObjectModel, FileMaker

This line allows each of the following lines to assume access to both the objectModel and FileMaker tables. For example we can use delete () instead of FileMaker.delete ()

delete (request [all])

create (request, {"Ben","Frank"})

FileMaker finds are first set up through requests. Requests are persistent, so any old requests must first be deleted and a new one created.

The new request created here puts the string 'Ben' in the first field of the database and the string 'Frank' in the second field of the database

find ()
This simple verb tells FileMaker to perform a search based on the request just created. Any records whose first field contains 'Ben' and whose second field contains 'Frank' would be part of the found set. If this database is a Who's Who of Revolutionary War figures, odds are this find would return one record for Benjamin Franklin. If this database is the New York telephone book, then this search would probably return more than one record.

sort(document[1], field[2])

This line sorts the current found set by the second field, which in this example is for last names. The sort defaults to ascending order, though this is controllable by your scripts. So 'Ben Frank' appears before 'Benjamin Franklin.'

local (foundSet)

foundSet = get (document [1].record [all])
First you must declare the local foundSet, then set it equal to the results of the search. Use the get verb to retrieve data from a FileMaker database.

This code is most useful for putting a searchable database on the web. See the Webstar page for general information on Frontier CGI scripting.

Other Applications

Since many applications are scriptable, you can use Frontier as the go-between to get FileMaker talking to clip2gif, BBEdit, Fetch, Eudora, and more. Here a few ideas which show some of the power of FileMaker, Frontier, and how they work with other applications.

Storing Graphics

Perhaps you're a web-graphics designer, and you want to keep track of your library of gifs and jpegs. FileMaker could catalog and manage your collection. Frontier would be the conduit for FileMaker, clip2gif, and the Finder. FileMaker could store each graphic, or a reference to the graphic file, and information such as filename, location, measurements, where the graphic is being used, and so on. You could use "MacBird" for your user interface.

Web Robots

Perhaps you want to create a database of other other web pages. Using the new TCP extensions to Frontier, you could write a web robot that went out to the web, cataloging and storing web pages in a FileMaker database.

Email Archiving

Eudora is scriptable too. Perhaps you want to save the occassional mailing list post for later reference, but don't want your Eudora mailboxes to become overgrown. You could write a script and add it Eudora's shared menu that would take the current message and save it in a FileMaker database. Any time you want to save a message, hit a command key, and the message is saved in FileMaker. Then you've got your own searchable archive, your own reference system.


WorldWide Power's FileMaker Reference: This developing resource will include a searchable database of FileMaker scripting links, example code and applications, and many pointers to other FileMaker Pro scripting sites on the web.

Claris Apple Event Reference: Claris provides excellent references and examples. Start here to get a general understanding of how FileMaker is scripted.

"Frontier & The Object Model": The Object Model is Apple's way of providing a common way of scripting different applications. Frontier fully supports Object Model scripting.

Filemaker CGI Tutorial: Preston Holmes' tutorial shows you how to put your FileMaker database on the World Wide Web.

FileMaker Verb Set: Here you will always find the latest version of the Frontier verb set for FileMaker.

Blue World's FileMaker Website: Blue World has put together an impressive web site, including a white paper on FileMaker as a web database platform and list of cool sites using FileMaker.

MacSite Searcher: a commercial Frontier/FileMaker CGI and website-indexing package.

© Copyright 1996-98 UserLand Software. This page was last built on 5/9/98; 8:29:20 AM. It was originally posted on 5/10/96; 2:58:34 PM.