How to Build a Search Screen

A search screen is a major part of the systems that we have to build. Once data has been created, it is always necessary to be able to find it again, to modify and view submitted data. Search screens are also used to search and add Contacts and Organisations.

COMPONENTS

There are 5 main components of a Search Screen Module. They are:

Below is a screenshot of the LAYOUT1 module:

This module determines the layout, borders and classes of all parts of a basic screen. The actions at the top are standard navigation actions stored in buffers. These can be over-ridden to remove the action from a screen as necessary.

A search screen does not create, or modify any data. It simply initialises a schema, and queries data into that schema using restrictions specified in the query. This means a search screen will use a memory only Storage Location. (See Worksheet 33 for examples).

The picture below shows a typical Search Screen Layout with all the important components as listed above:

What Is Needed in The Module?

Incremental multiple selection. Fm:remove, and DB Interface primary keys.

When a search is done in order to add to another list, a tickbox is used in order to select the ones you want to be passed on. In order to be more efficient in this and not have to add one or just a couple of results at a time, you can use what is called incremental multiple selection. This allows you to perform a search under one criterion, and then select the ones you want to keep and perform another search with different criteria. This means that you can add all the results you want in one go.

There are two methods to do this, the first one is to not remove ones that you have already been selected to save, and perform an add-to method of search. There is one problem of this, when identical results are returned from two different sets of criteria, you can actually select the same person twice.

The other method to do this is to pass in the primary keys of the ones that are already selected into the query that is searching with the new criteria. This is effectively an augment method. This way you will not get duplicate results.

EXERCISES

Exercise 1

 
Make a search screen that searches the employee_search table (on schema SCOTT). It should utilise LAYOUT1, so it displays similarly to the pictures on this worksheet. It should be able to search based on all available columns except ID. A Search and Reset button are required on the module. After searching, the list of results should display under the search criteria and should display the number of rows retrieved from the search underneath. The Title and Gender columns should utilise optional map-sets (either from data stored on the database or using templates).

Once complete, it should look similar to the picture above.