Previous | Table of Contents | Next
Page
370
FIG. 14.27
The Employee Update
form employee
image property sheet
and settings.

- Select and expand the block ONE object on the Object Navigator.
- Select the triggers object under block "ONE." Press the create button on the
Tool Palette. The Triggers dialog box will appear.
- Select post-query as the type of trigger from the dialog box. Press the OK button.
The PL/SQL editor will appear.
- Enter the PL/SQL script from Figure 14.27 into the PL/SQL editor for the trigger.
The script assumes the image files will be on the CD (drive d). If you change the location,
the directory path will change also. Press the compile button to syntax check the
PL/SQL script.
- Generate and run the application.
Figure 14.28 illustrates the PL/SQL block contained in the post-query trigger.
FIG. 14.28
The post-query trigger
PL/SQL statements
used to populate the
image item.

This trigger constructs the filename by using the employee's payroll number from block
ONE. The trigger is fired as each new record is displayed on screen. This will populate the
image
Page
371
item with the contents of the image file. Figure 14.29 displays the executed Employee
Update form showing the employee's photograph.
FIG. 14.29
isplaying the photo of
the employee on the
Employee Update form.

A list of values, or LOV, is a modal dialog box that displays the results of a Select statement
or record group. The results of the record search can place a value into an item or validate a
value placed into the item. Items that are foreign keys are always a candidate for a list of values.
The reason is the value contained in the foreign key must always exist in a related table. On
the Employee Update form, the employee's department number is a foreign key. It is used to
relate the Employee table to the Department table. It is a prime candidate for a list of values.
A LOV consists of two objects. The first is the data acquisition object called a
record group. This object consists of a SELECT statement that will return the records needed by the LOV.
The second object is an LOV dialog box. It displays the records returned by the record
group. Normally the record group is created at the same time the LOV is created. However, it can
be created separately and referenced by the LOV.
Perform the following to create a LOV and record group:
- Open the Object Navigator, select the LOVS object, and click the create button. This
will open the New LOV dialog box.
- Enter a SELECT statement into the Query Text window of the dialog box. You may
instead select an existing Record Group by clicking the Existing Record Group radio
button. This will activate the Select button and display a list of existing record groups to
select from. Press OK when done. Be sure to use an
order by clause if you desire the list to be ordered.
- The default names of the LOV and record group are generic. Change the names of
each of these items to a more meaningful name. Double-click the button and modify the
item's name property. It can also be changed directly on the Object Navigator.
- Open the LOV property sheet. Modify the properties to suit. Be sure to give the LOV
a name by updating the Title property.
Page
372
- Select the Column Mapping property. This will bring up the More button. Click
this button. This will launch the LOV column mapping dialog box.
- The top window contains the name of the LOV columns. If you want the value to
be selected into an item, place the name of the form item including its block name as
a prefix in the Return Item window. Change the Column
Title property to suit. Perform this procedure for all items. Press OK when done.
- Open the Object Navigator and select the item that will use the LOV. Open the
item's property sheet. Locate the Miscellaneous properties at the end of the sheet.
- Enter the name of the LOV in the
LOV property. When selecting this property a pick
list button will appear. The name of the LOV can be selected from the list. Change the
LOV For Validation value to true if the LOV is to be used for validation. Update the
X and Y coordinate properties to suit.
This example will illustrate the creation of a LOV for the department field on block ONE of
the Employee Update form. The following are the steps to add the LOV.
- The first step is to open the Object Navigator and create a
LOV object.
This will bring up the New LOV dialog box, as shown in Figure 14.30. The Select
clause in the Query Text window will retrieve the department records for the LOV.
FIG. 14.30
The New LOV dialog box
containing the Select
statement for the LOV's
record group.

- Enter the select clause contained in Figure 14.30 into the Query Text window.
- Click the OK button on the dialog box to create the
LOV object and a record group object.
Figure 14.31 displays the Object Navigator and the default names created by Forms.
- Change the name of the LOV and record
group to DEPT.
- The next step is to open the LOV's property sheet, which contains a number of
format settings.
- Change the settings in the property sheet to match those contained in Figure 14.32.
Figure 14.32 shows the completed property sheet for the Department LOV. The
X Position and Y Position properties were changed in order to locate the LOV in the middle of
the screen. The LOV was given a title by using the
Title property.
A visual attribute was used to populate the properties on the LOV in Figure 14.32. It was
used in order to maintain consistency in look between this LOV and any other LOV created on
the
Previous | Table of Contents | Next
|