Release 10.1A: OpenEdge Getting Started:
Progress OpenEdge Studio

> ## Dynamic Query module

> To add flexibility to your applications, the Progress 4GL enables you to build dynamic queries. With the dynamic query structure, you do not have to anticipate and code every case for which an end user might want a query. At run time, end users can design their own queries to fit exactly the questions they need to answer.

> | To launch this module, choose the Dynamic Query button on the SportsPro main window. The Find Customer dialog box appears:

> When you launch the Dynamic Query module, it accepts the handle of a SDO on the SportsPro main window to serve as the data source for the query. As you create a query using the buttons in the upper section of this window, the module records the contents of the For Each Customer Where editor as a variable. Choosing the Search button launches the module’s Search procedure. The Search procedure accepts the handle of the user input variable and uses it to replace the SDO’s `WHERE` and `SORT` clauses.

> Table 2–3 describes the major objects used in the Dynamic Query module.

> Table 2–3: Components of the Dynamic Query module
> Object or filename | Object type | Function
> --- | --- | ---
> `wfndcust.w` | SmartWindow | Serves as a container for the other objects in the module.
> `dcust` | SDO | Queries the Customer table to retrieve all customer records for the selected query. When this module is launched, it accepts the handle for the instance of `dcust` in the SportsPro main window. Note: Because this module uses a handle passed in from the main window, you must run the main window and launch it from there.
> `getnewfields.p` | Procedure file | Runs during the initializeObject internal procedure to populate the lcustfieldname selection list.
> lcustfieldname | Selection-list | Lists the fields in the Customer table that can be added to the query.
> qrystringdisp | Editor | Displays the query being built. Its contents are passed to the Search internal procedure.
> btnsearch | Button | Runs the Search internal procedure to display the records matching the query shown in the qrystringdisp editor.
> sortfld | Combo-Box | Lists the fields by which the result set can be sorted.
> lsort | Radio-set | Sets whether the result set is sorted in ascending or descending order.
> bcust | SDB | Enables the user to select a customer record based on the query shown in the editor and the sort criteria.
> btndspcust | Button | Launches `wdspcust.w`.
> `wdspcust.w` | SmartWindow | Serves as a container for the other objects in the Display Detail section of the module.
> `vcust2` | SmartDataViewer (SDV) | Displays full details of the customer currently selected in `bcust`.
> `stxtfld` | SDF | Displays the Comments field in `vcust2` in a Cut/Copy/Paste editor.

> Note: The Dynamic Query module also runs when you choose the Find Customer button in the Customer section of the SportsPro Order Tracking System.

> For more information on building dynamic queries, see the chapter on using dynamic queries in the OpenEdge Development: Progress 4GL Handbook .

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