Previous | Table of Contents | Next

Page 542

FIG. 20.3
The Block One Preinsert
trigger used to generate
the new payroll number
for added records.



FIG. 20.4
Canvas2 and the block-
one item layout.


Canvas4 is the next canvas created. It contains the records for the Tools and Eyeglasses tables. They are contained on blocks "five" and "six." Figure 20.5 shows this layout.

Canvas5 displays the records for the Appraisals and Classifications tables. These records are contained on blocks "two" and "three." The Payroll_deduct item on block two was changed to a check box. Figure 20.6 shows this layout.

Page 543

FIG. 20.5
Canvas4 and the block
"five" and "six" layout.



FIG. 20.6
Canvas5 and the block
"two" and
"three" layout.


Two buttons were placed on the Button Palette to enable the operator to change the displayed canvases. Clicking the "Tools/Eyeglasses" button brings up canvas4. Clicking the "Class/Appraisals" button brings up canvas5. Figure 20.7 shows the Employee Update button palette.

Page 544

FIG. 20.7
The Employee Update
button palette that
contains the buttons
to change canvases.


Creating Classification RecordsThe Classifications table contains historic classification records. The current classification attributes are retained on the Employees table. These columns are redundant to the columns on the Classifications table. They were placed on the Employees table so the secretary responsible for the database would not have to create a join to produce a report. Placing these fields in the Employees table violates the table normalization rules. This is sometimes done in order to increase the user friendliness of the database. The redundancy does cause the developer some problems. The developer must make sure the current classification values in the Employees table are saved in the Classifications table before the new values are placed in the Employees table.

In order to ensure that the proper updates and inserts occur, some special programming was developed for the Employee Update form. A button, called New Class Rec, was placed at the bottom of the form. Clicking this button opens a new window called New Classification Record Entry. Canvas3 and nonbase table block "four" are displayed in this window, as shown in Figure 20.8.

The new values are placed in the fields in this window. Clicking the Save button fires a trigger. This trigger inserts a record into the Classifications table. The record contains the values currently in the classification items on the Employees table. The trigger then moves the new values from the window to the corresponding items on block "one." A commit is then issued to save the block "one" changes. The trigger then causes the input focus to change to block "three." This will close down the New Classification Record Entry window. Finally, the trigger causes block "three" to execute a query. This will return the inserted Classifications record to the screen. Figure 20.9 shows the trigger.

Page 545

FIG. 20.8
The New Classification
Record Entry window.



FIG. 20.9
The When-button-
pressed trigger that
creates the Classifica—
tions Record and
updates the Employees
table with classification
changes.


Page 546

Remaining ChangesThe Employees form needs some remaining standard changes. The form-level preinsert, preupdate, and predelete triggers used on the Department Update screen should be placed in the form. The easiest way to perform this is to open the Department Update form and drag the items to the proper location on the Employee Update form. Designer will then copy these items into the form. The Form_Security_Checks procedure is also copied into the form.

A When-new-form-instance trigger is created. This trigger has the same code as the trigger outlined in Chapter 16.

The Employee Directory Form (Empdir.fmb)

The Employee Directory has the same design as the directory described in Chapter 16, except for two minor additions: The number of records displayed was changed to 14 and a LOV was added for the Department item on block "one." The LOV will help the user in determining the proper department code to enter in the search field. Figure 20.10 contains the final Employee Directory.

FIG. 20.10
The Employee Directory.


The Security Update Form (Empsec.fmb)

The Employee system is a secured system. The user must have a valid payroll number, password combination, and security option value of AUD to modify the database. These security

Page 547

values are contained in the Security table. Normally in a production system, the security table is not available for modification or viewing. The table is accessible only through a secured application by a security administrator. The Security Update form described in this section is such an application. It is the form used by the security administrator to manage the Security table. Triggers are placed within the system to ensure that the security administrator is the only operator who may access this form. This requires the security administrator to have a special security option of "SEC." A trigger will be placed in the menu checking whether the operator has a security option of "SEC." If the operator does not this option, access to the Security Update form will be denied.

The Security table is the only table displayed on the Security Update form. The table contains two columns: payroll_number and security option. A one-block form that does not encompass the entire screen will be adequate for this data. Figure 20.11 displays the form with several security records displayed.

FIG. 20.11 The Security Update form displaying security records.


The form must also have the same form-level preinsert, preupdate, and predelete triggers used as security control throughout the book. The form must also have the Form_security_checks procedure. This option has been modified to check for the SEC security option rather than the AUD. Figure 20.12 shows this procedure.

Page 548

FIG. 20.12
The
Form_security_checks
procedure used in the
Security form.


Access to the screen will also be controlled by using this procedure in the menu command that calls the form. This trigger will be discussed in the following section.

The Employee System Startup Form (Eemptup.fmb) and System
Menu (Esysmenu.mmb)

The design of the Employee System startup form and menu is fundamentally the same as discussed in Chapter 16. The main changes are the name of the forms called by the menu, a security check trigger in the Security form option, and a new image on the startup form. You can use the image file factory.pcx. The on-logon trigger must use the new user id created in installment 2.

The major change is to the Security form menu option. A trigger is placed in the menu command, which prevents unauthorized operators from calling the form. The modified security trigger is shown in Figure 20.13.

After compiling all the forms, the Employee system is ready for use. It is executed by launching Forms Runtime and the startup application Empstup.fmx.

Previous | Table of Contents | Next