Progress
Application Development
Environment — Getting Started


Dynamic Query Module

Before Progress Version 9, you had to define the selection criteria at compile time. You could achieve limited flexibility by using IF...THEN...ELSE or CASE statements. Progress Version 9 introduced new language elements that enable you to build dynamic queries. With the dynamic query structure, you do not have to anticipate 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.

Choose the Dynamic Query button on the SportsPro main window to launch this module:

When you launch the Dynamic Query module, it accepts the handle of a SmartDataObject 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 SmartDataObject’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 File Name
Object Type
Function
wfndcust.w
SmartWindow
Serves as a container for the other objects in the module.
dcust
SmartDataObject
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
SmartDataBrowser
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
Displays full details of the customer currently selected in bcust.
stxtfld
SmartDataField
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 widgets in the Progress Programming Handbook .


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