| ## Developing a Database Application: The dBASE Plus Tutorial Ken Mayer, Senior SQA Engineer, dBASE Inc. Michael Nuwer, dBASE user

Preface

### The Purpose of this Tutorial

dBASE Plus is a great rapid application development (RAD) environment. However, many folk are not sure where to start in the development of an application or how to use the tools included with this amazing software.

The purpose of this tutorial is to guide a database developer through the process of creating an application in dBASE Plus, from building the database to it's final deployment.

dBASE Plus is a 100% pure object-oreinted programming tool. The tutorial project will focus on using the dBASE Plus data access objects; it will guide you through the objects used to create forms, reports, and an application menu; and it will show you how to deploy a complete application.

This process will take some time, so this is broken down into individual parts. As a student you can work along when you have time and come back and pick up where you left off. Do not assume that you can just "whip through it" and be done quickly. While the application created during the process of this tutorial is not a "complete" application, it still has many inter related pieces. In the past, users have, for the most part, taken a minimum of one week to complete this project.

> NOTE: If you find any typos, errors, or have a difficult time understanding any part of this tutorial, please use the dBASE, Inc. public newsgroups. Information on these can be gotten at the dBASE, Inc. website: http://www.dbase.com. Use the "Help" link, and at the top of the Technical Support page is a link to a webpage that explains how to use the dBASE newsgroups.

### New to the Third Edition

This Edition of the Tutorial Project is tailored to dBASE Plus. In addition, Phase II, Creating the Database, and Phase III, Creating the DataMoudules, have been rewritten so as to take full advantage of the dQuery II interface.

Support has been added for the "inherit from" menu item when creating datamodules with dQuery. This option was not available in dB2K.01. It is available with dB2K.04 and dBASE Plus.

The use of a Source Code Alias has been removed. In the second edition, the Source Code Alias caused more confusion than any other part of the Tutorial. A Source Code Alias is an extremely useful tool and you should considering using it when you build your applications. But there is plenty of new material to learn before introducing this topic.

An onClose event handler has been added to the BASE.cfm form. This event handler is intended to release from memory any form derived from the custom class. Pervious versions of the Tutorial Application could cause system resource problems because forms were not properly released.

We have added some code to the custom combobox control which handles those times when the combobox appears to change data but it doesn't. This code was included in the first edition of the Tutorial, but seems to have gotten lost in the Second edition.

Finally, the walkthrough application has been restructured so that it will run in without a database alias. In the previous Edition, the walk through was an executable file. Now it is a collection of source code files. (November 11, 2002)

### New to the Second Edition

This is the Second Edition of the Tutorial Project. The first edition was written for Visual dBASE 7.01 by Ken Mayer and last updated November 8, 1999. The text of the Second Edition is a complete face lift so that it corresponds with the many new features offered by dB2K. The updates were made by Michael Nuwer and released June 30, 2001. Among the new features found in dB2K are dQuery/Web, Source Code Aliases, and Dynamic External Objects (DEO). The Second Edition integrates each of these new technologies into the Tutorial Project.

Another significant change that will be apparent to anyone who has worked through the First Edition of the Tutorial is the addition of a new Chapter on Creating Custom Components. In the First Edition, the Tutorial used a pre-created set of custom controls. In this Edition you will create your own custom controls and use them in the application.

Other new material includes a brief discussion of data validation and creating calculated fields in the Chapter on "Creating the DataModules". A new report, the Customer Account Statement report, is added to the Chapter on "Creating the Reports". This report offers some interesting material related to the linkage tables and calling the report.

Other changes include 1) the use of DataModule objects rather than DataModRef objects and 2) the use of TextLabel objects rather than Text objects. Both the DataModule class and the TextLabel class were introduced in February 2000 when Visual dBASE 7.5 was released. The DataModule class reduces much of the complexity associated with dataModRef objects and the textLabel class reduced the memory overhead associated with Text objects.

The Project Explorer is no longer included in the Tutorial. With the introduction of DEO, compiling and building an application has become rather simple. The Project Explorer is, therefore, no longer needed.

For those who have paid very close attention to the code used in the First Edition, you will notice that the canClose method that was in the DataForm.cfm has been moved to base.cfm. Since the DialogForms and the Dataforms were calling this method, it seemed appropriate to locate it so that either form would inherit it.

### Special Thanks

There are many people who have helped with this Project. The First Edition would not have been completed without:

- Peter Rorlick insisting (loudly) that a tutorial was necessary (in the newsgroups) in the first place;
- Both Peter and Gary White looking at the source code for the project as Ken Mayer created it, and helping him design something that made sense (and sometimes very loudly insisting that he reconsider some of his own design ideas.);
- Both of them going over the early text to ensure that it wasn't talking in circles;
- Both Peter and Gary have been good sounding boards with a lot of patience when Ken wasn't getting what they were trying to say;
- Gary cleaned up some of my screen shots used in the First Edition;
- Gary and Peter both provided code ideas that made the whole thing better (some of this code has made it into the dUFLP library).
- Ken Chan for a bug workaround with the Windows menu and some help with the aggregate functions in the reports.
- Bob Rimmington was brave and tested the First Edition in "Alpha" stages, and helped Ken make sure the flow made sense)

In addition, there were many folk who helped test the tutorial before the First Edition was released to the general public. Ken received some good comments from various Beta testers, including a lot of re-writes for clarity in the text, a lot of the "Notes" were added based on input from the testers, and some (gasp) bug fixes in the code. These tester were: Robert (Bob) Newman (Bob found a really serious problem in the deployment section of the tutorial, as well as lots of good commentary throughout), Richard Sandies, Frank Polan, Barbara Betcher (Barbara suggested the Goals section for each of the different Phases of the tutorial, and provided screen shots for some of the areas she had concerns over -- this was very helpful), Steve Robertson, Denise Allred, Richard Clark, Bernard Mc Clement, Richard Forrest, and Jørgen Feder. The second group of Beta tester were Roy Manuell, Santo Lo Galbo (Santo tested on the Italian version of Visual dBASE 7, and it worked there, which is good to know), Gerald Lightsey (Gerald provided tons of nit-picky commentary -- which is good -- various typos and minor glitches got found, as well as a few big ones, particularly in the Invoice report), Wes Rue (the first to complete the project through to the end), and Jim Garrett.

The Second Edition of the Tutorial owes a great deal to the dBASE community. Over the last few years that I have been active in the dBASE Newsgroups, I can not remember one cross word directed at "Ken's Tutorial". But there has been a ton of praise and gratitude. The overwhelming support of the user community voiced day after day both encouraged and energized this update.

Ken Mayer encourage Me (Michael Nuwer) to write the update and had faith that I could pull it off. The Second Edition of the Tutorial also benefited from a great group of testers. Tim MacAlpine set the pace during the testing period. He was often the first to find my errors and cleared the path for others. Barbara Betcher, who was a beta tester for the First Edition, offered her help again. The clarity of this document owes much to her detailed comments. Duane Bays and John Creed brought a great deal of experience to the testing period. Their extensive comments saved me from making some big mistakes. I would also like to thank Mario Trzesniowski, Don Archibald, Jean Chenaille, and Don White for offering valuable contributions to this project.

Proceed to the next part of the tutorial: Introduction
Go back to the tutorial menu

Last Modified: November 11, 2002

The Legal Stuff: This document is part of the dBASE Plus Tutorial created by Ken Mayer and Michael Nuwer. This material is copyright © 2002, by Ken Mayer and Michael Nuwer. dBASE Plus is copyrighted, trademarked, etc., by dBASE, Inc., the BDE (Borland Database Engine) and BDE Administrator are copyrighted, trademarked and all that by Borland, International. This document may not be posted elsewhere without the explicit permission of the authors, who retains all rights to the document.