Previous | Table of Contents | Next

Page 415

FIG. 16.4
The Department Update
form as it would appear
by using the
call_form subprogram
with no options specified.





FIG. 16.5
The When-button-
pressed trigger that
calls the Department
Update form. It con-
tains the no_hide
option.





FIG. 16.6
The Department Update
form as it would appear
by using the
call_form subprogram
with the no_hide
option specified.



Page 416

Creating and Using a Directory

A directory is an application used to help the operator identify records. It is a tabular style form that produces a set of records based upon entered search criteria. At times the operator does not have complete information about the record to be selected. The directory allows the operator to enter some information and compile a visible list to records to choose from. For instance, suppose the operator wanted to identify the record for the employee with the last name "Kwasniewski." This is an extremely hard name to spell. The operator can enter the following expression in the last name search field: "K%ski". This will produce a short list of employee records that match the expression. The operator likely will be able to identify the record from the list.

Directories consist of three blocks. The first block is a nonbase table form style block that contains the search fields. The second block is a multi-record tabular style block that displays the results of the query. The operator does not have the ability to enter search values into this block. The third block is the button palette. In addition to the normal buttons, it generally contains buttons that call related forms. These forms are used to view additional information about the selected instance.

This design offers some distinct advantages over the straight tabular style form that uses the display fields as the search fields. The fields contained in the search block do not have to be visible in the display block. This means the directory can contain more search fields than the typical tabular form. The search fields are contained in a form pattern and are not limited to the width of the screen as in a tabular form. A second advantage of the directory is that the search criteria remains after the query is executed. In a normal form, after a query is performed, the search criteria are cleared. The operator must reenter the search expressions before a query can be performed. In our example of directory use, if the "K%ski" expression produced a large record set, the operator might be able to limit the set by entering a department number or adding additional characters to the expression. The operator would not have to re-enter the original search criteria since it was still contained in the search text item. This will increase operator efficiency.

Creating a Directory

The following are the basic steps needed to create a directory:

To create the search block, use the following steps:

  1. Create a new form module on the Object Navigator. Select the blocks object and press the create button. This will open the Default Block dialog box.

  2. Enter the name of the view or table that will be used in the Display block. The block name should be "one."

  3. Select the search fields from the items displayed in the Items tab. Change the item labels to suit your desire.

  4. On the Layout tab: the Style is Form, the Orientation is Vertical, and the Records equal one. Click OK to create the block.

Page 417

  1. Open the Layout Editor. Arrange the items and boilerplate. Select all of the text items. Open a multi-item property sheet by double-clicking one of the items. Change the base table property to false, and the case restriction property to upper.

  2. Open the Object Navigator. Change the tab order of all the items by dragging and changing their positions. Open the block-one property sheet. Change the Base Table property to <Null>.

To create the display block, use the following steps:

  1. Open the Object Navigator. Select the blocks object and click the create icon. This will open the Default Block dialog box.

  2. Enter the name of the view or table in the base table item. The block name should be "two."

  3. Click the Items tab. Select the fields that will be displayed on the block. The block-one search fields that are not displayed fields should also be selected. Change the item labels to suit. Delete the label text for the fields that will not be displayed.

  4. Click the Layout tab. On this tab: the Style is "tabular," the Orientation is "Vertical," and the number of records equal to 10. The Button Palette and Scrollbar checkboxes should be checked. Click the OK button to create the block.

  5. Open the Layout Editor. Select all of the items that will not be displayed. Open the multi-item property sheet by double-clicking one of the items. Change the Canvas property to "<Null>" and the Displayed property to "false."

  6. Select all of the displayed items. Open the multi-item property sheet. Change the Insert Allowed property to "false" and the Update Allowed property to "false."

  7. Rearrange and position the block-two items and the button palette buttons.

  8. Open the Object Navigator. Select each of the items on block two that are search fields on block one. Open the property sheet of each item and enter the name of the corresponding block one item in the Copy Value From Item property. Be sure to preface the item name with the block name.

  9. Create a form level Key-entqry and Key-exeqry trigger. The PL/SQL code block for these triggers is as follows:

              go_block go (`two');
    
    
              execute_query;
    


  10. Open the When-Button-Pressed trigger for the Button Palette Query button. Delete the existing code block and replace it with the code from #9.

  11. Open the Layout Editor. Select the Edit, Select all menu option. Open a multi-item property sheet. Change the Required property to "false."

The preceding steps can be used to create a basic directory. The developer may add LOVs and form calling buttons as needed. The following section demonstrates the creation of an Employee directory.

Previous | Table of Contents | Next