5. Using FileFlex with FoxPro

One of FileFlex' most valuable features is it's compatibility with FoxPro from Microsoft. The pairing of these two products can give you some amazingly powerful capabilities.

FoxPro is an impressively full-featured relational database system. It has code-compatible counterparts available on Macintosh, DOS and Windows, and of course, is supported by the huge Microsoft development, sales, and support organization. FoxPro provides all the capabilities you'd ever want in a relational database product including interface development, reporting, multiuser capability, and a library of thousands of applications built using it's own dBASE-derived programming language. FoxPro even supports AppleEvents, allowing you to create AppleScript scripts to drive interaction with the database and other Macintosh applications.

This awesome power, however, comes at a considerable price. FoxPro is distributed on eight high-density floppy disks which, when loaded on your computer, use up to 23 megabytes of disk storage. The program itself takes over 3 megabytes of disk space and needs a minimum of a 5 megabyte partition to run.

FileFlex and FoxPro are studies in contrast. While FoxPro takes an enormous amount of disk space (up to 23 megabytes), FileFlex takes about140K. While FoxPro requires a 5 megabyte RAM partition, the FileFlex embedded database takes about 100K of RAM.

Of course, FileFlex doesn't provide nearly the capabilities that FoxPro does. FileFlex doesn't have a report writer, it doesn't have an interface builder (in fact, FileFlex has no interface features of any kind), and it doesn't have all advanced database features that FoxPro has.

Yet FileFlex plays a very important role in your development strategy. That's because you can embed full relational database functionality inside your applications with a RAM cost of about 100K. You don't have to worry whether your users have FoxPro, nor do you need to worry about whether they've installed all 23 megabytes or have all that extra RAM to let it run.

Fundamentally, FileFlex allows you to add relational database capabilities to your application at virtually no cost in system resources and without any special awareness on the part of your users.
FoxPro compatibility opens huge vistas of capabilities to your application. That's because FoxPro becomes an add-on Power Tool for your application. Let me give you a few examples:

Embedded Database for Multimedia

You've developed an information kiosk for a local bank in Director. Users can interact with the kiosk, getting high-quality multimedia presentations on the bank's services. They can also enter information about themselves and the services they're most interested in.

The Director application and your production take up the vast majority of system resources. FileFlex, embedded in your Director production and using only 100K, captures customer information and saves it in database files on the kiosk's local hard disk.

Later, some bank executive decides he wants to see a complex report about the customer's who've used the kiosk - and he wants to see it weekly. Clearly not a job for FileFlex but a very easy job for FoxPro. On a separate computer (it might even be an analyst's Windows or DOS machine!), a quick report is built in FoxPro that uses the data saved off in FileFlex. Instant report. No data conversion. No hassles. The full power of the high-end FoxPro relational database where it's needed and the streamlined behind- the-scenes capabilities of FileFlex where it is need.

Transparent Access to PC Data

You've built a wonderful internal office management system in Authorware. It does everything you need and fits everyone's needs perfectly. That's because it's been developed and refined regularly for the past four years.

But now you want a new feature. You want to subscribe to a service that provides all the names, addresses, and phones of everyone in the US - on a CD-ROM and updated monthly. Unfortunately, the CD-ROMs are in dBASE format, intended to be used with a FoxPro database running on a DOS PC.

With FileFlex, you're able to access that data from within your custom application - without being forced to recode it to run completely in FoxPro.

There's also a reverse benefit here as well. You sell your own "house"mailing list through a list broker. Ever two or three months, you send them an updated list of names. But - you guessed it! - they're a PC house and they need data readable by FoxPro. No problem. Use FileFlex to maintain the names inside your Authorware application. When it's time to send the mail list broker a new list, just copy the file and send it off to them. No format conversion.

Programming in the Language of Your Choice

Many people don't like programming in the old dBASE programming language. Modern languages and tools are often object-oriented or targetted to accomplishing specific sorts of tasks (like Lingo for creating multimedia). Even if you need to generate data for use by FoxPro or other dBASE systems, why should you be forced to program in the old dBASE or FoxPro language?

With FileFlex you're not forced to use a language you don't like. Use FileFlex within the development language of your choice and you'll still create files in the format you need.

In each of these examples, your application was in use. FileFlex was behind the scenes and totally invisible to your users. FoxPro was available to help with support and analysis, but it wasn't an integral part of your application. Your application retained its full identity, yet got access to a powerful new tool for support and analysis.

That's the power of the cross-compatibility between FileFlex and FoxPro.

FoxPro <-> FileFlex DBF File Compatibility

Both FoxPro and FileFlex use the industry standard DBF file format (also called xBASE format) as their native file formats.

Both FileFlex and FoxPro can read each other's DBF files without any special conversion or transformation.

There are some minor exceptions. FileFlex does not support the following FoxPro field data types: When you design your database, make sure you avoid these field types if you want full data interchange between FoxPro and FileFlex.

FoxPro <-> FileFlex Memo File Compatibility

Both FoxPro and FileFlex have memo fields. These are large, non-indexed fields containing up to 32K of free text. In both products, memo fields are stored in files separate from the DBF file. However, FoxPro's native memo field file format is called FPT, while FileFlex's is the more industry standard DBT format. The DBT format is used in dBASE, xBASE, and even in FoxBase+, FoxPro's predecessor.

FoxPro can read and write FileFlex DBT files. FileFlex cannot read and write FoxPro FPT files.

There are a couple of simple steps to make sure your memo files can be interchanged between FoxPro and FileFlex.

Text-Only Memo Fields

Neither FoxBase nor FileFlex can support binary information stored within memo fields. If you want to be sure of reliable data interchange, don't store binary data in memo fields.

Create Your Databases in FileFlex

Whenever possible, create the database file using FileFlex. If you define a memo field, FileFlex will automatically create the proper DBT file.

SET COMPATIBLE FOXPLUS

When in FoxPro, before you access a FileFlex file, use the SET COMPATIBLE command. To make sure you're staying compatible with FileFlex data, issue the following command in your FoxPro application or type it into the command window:
SET COMPATIBLE FOXPLUS

Converting to FileFlex Memo Files


When you create a database within FoxPro, it automatically creates the FPT format memo files, even if you've used SET COMPATIBLE FOXPLUS. But you can easily export your FoxPro-created file to a FileFlex compatible version. Once you've exported it to the FileFlex DBT format version, you can then read and write that format from within both FoxPro and FileFlex.

To convert a FoxPro table containing memo fields from FTP format to DBT format, you'll need to execute the COPY TO FoxPro command with TYPE FOXPLUS.

Note: FoxPro also offers a fancy Copy To dialog from the menu. For reasons known only to Microsoft, they left the FOXPLUS format option off the Copy To dialog. You'll need to execute it as a text command.

Index File Compatibility

FileFlex uses the xBASE standard NDX format. FoxPro does not. It uses it's own proprietary index format. If you change data in one program and then use it in another, you may want to make sure you check and update indexes.

There is a perverse twist on this concept:

Often databases are distributed in xBASE compatible format. One example of this is US Department of Census data distributed on CD-ROM. The data comes on the CD-ROM, as do the pre-built NDX format index files.

If you are a FoxPro user and you wanted to do an indexed lookup, it would be impossible. You'd have to completely rebuild the entire CD-ROM's index.

But FoxPro is one of those programs that will run XCMDs. So, you can load FoxPro with the FileFlex engine...(I told you it was a bit perverse!)...and use the FileFlex DBUseIndex, DBSelectIndex, DBSeek, and finally DBCurrRecNum functions to open the NDX index, search out the data needed by the FoxPro program, and return the record number back to the FoxPro program.

Strange, but true.




  [Previous Chapter]    [Table of Contents]    [Next Chapter]


Copyright (c) 1996 David Gewirtz under license to Component Software Corp. All rights reserved worldwide.