14 Understanding Search & Select Forms

This chapter contains the following topics:

14.1 Search & Select Forms

A search & select form is used to select a single predetermined field from a record in a predetermined file. Search & Select forms return only one value to the calling form, based on the dictionary alias. If no data dictionary (DD) alias matches the value, the first value from the data structure is returned.

14.2 Search & Select Events

These events can occur on the search & select form during runtime:

  • Dialog is Initialized

  • Post Dialog is Initialized

  • Grid Record is Fetched

  • Last Grid Record Has Been Read

  • Write Grid Line-Before

  • Write Grid Line-After

  • End Dialog

  • XAPI Subscribe Event

14.3 Search & Select Runtime Processing

This section discusses how runtime processes search & select forms. A search & select form should be attached as a visual assist only to data items that have the same data type as the form data structure element.

This section discusses form-level runtime processing only. Much of the runtime processing for the search & select "form" actually occurs on the level of the grid control, however.

See How Runtime Processes the Grid Control.

14.3.1 Dialog Initialization

When a search & select form is called, runtime initializes these items in this order:

  1. Thread handling

  2. Error handling process

  3. Business view columns (BC)

  4. Form controls (FC)

  5. Grid fields

  6. Static text

  7. Helps

  8. Event rules (ER) structures

Next, it performs these actions in this order:

  1. Create the tool bar.

  2. Load form interconnection data into corresponding BC and filter fields, if any.

  3. Fire Dialog is Initialized.

  4. Fire Post Dialog is Initialized.

  5. If the Automatically Find On Entry option is selected, begin detail data selection and sequencing in the grid control.

    If runtime does not encounter errors, this step leads to the population of the grid control, ultimately.

14.3.2 Find Button

The Find button is a standard button on headerless detail forms that appears by default. When the user clicks it, runtime fires the Button Clicked event. If no errors exist in the filter fields, runtime performs data selection and sequencing for the grid control. After reloading the grid with the fetched data, runtime fires the Post Button Clicked event.

14.3.3 Select Button

The Select button is a standard button on search & select forms that appears by default. When the user clicks it, runtime fires the Button Clicked event. If no errors occur, runtime writes the values from the selected row to the BC and fires the Post Button Clicked event. Then it fires the End Dialog event and initiates the dialog close process.

14.3.4 Close Button

The Close button is a standard button on search & select forms that appears by default. When the user clicks it, runtime fires the Button Clicked and Post Button Clicked events in immediate succession. If no errors occur, runtime attempts to close all of the modeless child forms, if any exist. If any of these child forms cannot be closed, the Close button process is terminated. Otherwise, runtime fires the End Dialog event and initiates the dialog close process.

14.3.5 Dialog Close

Search & Select can be closed either by the user (typically by clicking the Select or Close buttons) or by the system. After performing any control-level close processing that might need to occur, runtime closes the form. If the event has not already occurred, runtime fires the End Dialog event. Then it performs these tasks in this order:

  1. Load form interconnect data from BC for database commit.

  2. Terminate error handling.

  3. Terminate helps.

  4. Free all form structures.

  5. Destroy the window.