Progress
ADM 2 Guide


Filtering Records

You use the SmartFilter to allow your application users to filter records with user-specified selection criteria rather than built-in criteria. The SmartFilter follows the query-by-form model and is implemented as a dynamic SmartObject; that is, the selection criteria are specified at run time rather than being built into the object.

Progress provides the prebuilt master dynfilter.w for the SmartFilter. When you build a SmartFilter, you must define a Filter link to connect the SmartFilter to the SmartDataObject that will serve as its data source, optionally defining that SmartDataObject at this time. (You can also define it later in the Instance Properties dialog box.) The Filter link can be implemented as a pass-through link. (See the "Pass-through Links" section in SmartLinks.") This allows you to create a SmartFilter in a separate SmartWindow and wait to link it to the Filter-target until you drop the SmartFilter’s SmartWindow into the Filter-target’s SmartWindow.

Because the SmartFilter is implemented as a dynamic SmartObject, it does not have a Wizard, and you modify it at design time through its instance properties. You can specify both the SmartDataObject that will serve as the data source for the records to be filtered and the fields that the application user can filter. (See the "Customizing SmartFilters" section.) At run time, the user specifies selection criteria in the filter fields.

Note that the SmartToolbar contains a Filter button that can start a SmartFilter. If the SmartFilter is in the same Window as the SmartToolbar, it simply uses a Filter SmartLink. For instructions on linking the SmartToolbar if the SmartFilter is in a separate SmartWindow, see the "Connecting to a SmartFilter in Another SmartWindow" section.

Customizing SmartFilters

You customize the SmartFilter object through its instance properties. The SmartFilter has an Instance Properties dialog box (source program: src/adm2/support/filterd.w) that you can use to specify various filter properties. Unless you linked to a data source before you opened the Instance Properties dialog box, you must, at minimum, customize your SmartFilter by providing it with a SmartDataObject that will serve as its data source. By default, all fields are selected, but you can add or delete fields and change the order in which they appear. Because SmartFilter fields are generated dynamically, you cannot access their properties in the Instance Properties dialog box. However, you can access the most important field properties for each field: its label, width, tooltip, and HelpID.

You can also specify some additional properties of the filter itself:

See "SmartObjects," for descriptions of the SmartFilter instance properties.

Connecting to a SmartFilter in Another SmartWindow

Follow these steps to link the Filter button in a SmartToolbar to a SmartFilter in a separate SmartWindow:

  1. Create a SmartFilter in a separate SmartWindow, specifying all necessary instance properties, and link it temporarily as a Filter-source to THIS–PROCEDURE (the SmartWindow).
  2. Drop this SmartWindow in a SmartWindow with a potential filter—a SmartDataObject that matches the SmartFilter—and answer Yes to the Link Advisor’s prompt about adding the Filter link to the SmartDataObject.
  3. Optionally, specify HideOnInit and DisableOnInit in the SmartWindow’s Instance Properties dialog box and start the main SmartWindow.
  4. Check the Filter check box in the SmartToolbar’s Instance Property dialog box.

The SmartToolbar can now view and start the SmartFilter’s SmartWindow.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095