Skip to main content

Introduction & Special Features

All of the chapters up until now have been leading to a more comprehensive, complex, but also more realistic example of the kind of program people need to build in the average organization. This chapter will have much less text and code, but for that it has a very well documented example program that demonstrates many of the features required of a modern database-based application program.

Tip
Before reading and getting heavily involved in this chapter, it is a good idea to at least read through Chapter 5, Dialog-Style Programs and Chapter 6, GUI-Style Database Programs. Many of the techniques for working with the Form Designer and for creating database-oriented programs are covered in those chapters.


In this chapter we will discuss the features and special techniques used in the SIMPOL Business example program. This example consists of several database tables, four forms, and both a Quick Report and a Graphic Report. The basic design is a typical order entry system with the usual four tables plus a couple of extras. Here is a list of the database tables that are included:

  • COUNTRY
  • CUSTOMER
  • ORDERDTL
  • ORDERMST
  • PRODUCT
  • SERNO

The main tables are the CUSTOMER, ORDERDTL, ORDRMST, and PRODUCT. The COUNTRY table is a very carefully designed table that contains all of the current world country names, ISO-3166 2-character code, internet domain code, CEPT Code, capital city, currency code (3-letter), and the vehicle license plate international ID code. Only the country code is stored in the records from the CUSTOMER and ORDERMST tables. The SERNO table contains a record for each of the other tables, with the table name as the unique key and the current serial number value as the only other field.

There are also the four forms, one each for the CUSTOMER, PRODUCT, and ORDERMST tables with a detail block on the ORDERMST form containing the order lines from the ORDERDTL table. The fourth form is used for creating and editing entries in the ORDERDTL table and is called from buttons on the ORDERMST form.

Special Features

In comparison with the simpler Address Book example from the previous chapter, the SIMPOL Business application adds a number of new capabilities:

  • Switching forms and selecting a related record in the target table
  • Using preventfocusmode in an application to control user access to the data
  • Using the onsave event to do calculations when saving a record and to hide some buttons and enable others on the form
  • Using the onchangerecord event to detect entering data-entry mode to disable and show buttons on the form
  • Using the ondelete event to ensure that all the related detail records in ORDERDTL can be deleted before allowing the record in ORDERMST to be deleted
  • Adding, editing, and deleting records in a detail block
  • Using a Graphic Report for an invoice
  • Using a Quick Report as a sales report
  • Using a labels definition to output customer mailing labels, includig using a call to the new choicelistdialog() for the output destination
  • Integrating record view, table view, form view, field selection lists, the filter GUI, and the Quick Report GUI
  • Getting the user to select a record using the new drilldown() function
  • Using a serial number table to retrieve a unique serial number for reliability even in a network
    environment
  • Showing one value in a combo box list but assigning an alternate
  • Using the correct public data directory on modern Windows operating systems

All of these features are well-documented in the source code of the SIMPOL Business application. However we will still discuss a few of the more interesting features in the following sections.