skip to main content
OpenEdge Getting Started: Progress OpenEdge Studio
Working with the Sample Application : Running the sample application
 
Running the sample application
Running the SportsPro sample application gives you a feel for what you can build with the AppBuilder and SmartObject technology. The sample application contains several modules, each demonstrating a technique for solving a business problem. You will build parts of the Order Tracking System module in the tutorial and exercises later in this guide.
To run the SportsPro sample application:
1. If you have not already connected to the database, connect to your copy of the Sports2000 database. See “Creating and connecting to the Sports2000 database” section for information about connecting to your copy of the Sports2000 database.
2. Select the AppBuilder icon from the Desktop toolbar to start the AppBuilder. One of the windows that appears by default is the PRO*Tools palette:
3. Click the Run button from the PRO*Tools palette. The Run Procedure dialog box appears:
4. Type wmain.w for the Name of Procedure to Run.
If you copied the sample files as described in “Copying the sample files” section, you do not need to qualify the filename with its directory. The wmain.w file should be in your working directory which is a standard entry in your PROPATH.
5. Click Run. The main window of the SportsPro sample application appears:
The SportsPro application’s main window is a SmartWindow. Most of the buttons on this SmartWindow use the FLAT–BUTTON attribute to create a two-dimensional look.
Table 2–2 lists the components used in the main window of the SportsPro sample application. It lists all the procedure files, all the SmartObjects, and any simple objects with important functions. Except for SmartObjects like SmartFilters for which the Application Development Model (ADM) supplies the masters, the procedure files and SmartObject master files listed in this table are in the gui folder in your working directory.
 
Table 2–2: Components of the SportsPro main window  
Object or filename
Object type
Function
wmain.w
SmartWindow
Serves as a container for SDOs referenced by two of the modules and the buttons that launch the modules.
dcust
SmartDataObject (SDO)
Queries the Customer table to retrieve all customer records for the selected query. The query’s handle is passed into one of the modules.
BUTTON-1
Button
Launches wfndcust.w, passing it the handle for dcust.
BUTTON-2
Button
Launches wquery.w.
BUTTON-3
Button
Launches wdragdrop.w.
dorder
SDO
Queries the Order table to retrieve all order records for the selected query. The query’s handle is passed into one of the modules.
BUTTON-4
Button
Launches wfndord.w, passing it the handle for dorder.
BUTTON-5
Button
Launches wmntitem.w.
BUTTON-6
Button
Launches wordupd.w.
BUTTON-7
Button
Launches suppub.p.
BUTTON-8
Button
Launches gb2bintro.w. If you choose OK in the dialog box, it runs wstore.w.
BUTTON-9
Button
Launches worder.w.
Note: Table 2–2 and the tables in later sections present the objects and procedures from each module in an event-driven order. The objects contained in another object, and the procedures executed in that object, are listed directly after an object. Where data passes between objects and procedures, they are listed chronologically. Otherwise, objects are listed from top to bottom in their container.
Each of the buttons on the sample application’s main window launches a module. You can now examine these modules in turn. As you become more familiar with the OpenEdge products, you can return to these modules and examine them in greater detail. These modules show how to accomplish several common programming tasks.
Dynamic Query module
To add flexibility to your applications, ABL (Advanced Business Language) 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 OpenEdge Deployment: Managing ABL Applications.
Dynamic Buffer/Temp Table module
ABL puts the records that it reads into a buffer. Once a record is in the buffer, its fields are available to your application. While you can assign a static temp table for that buffer at compile time, you could not then change it at run time. For greater flexibility, ABL enables you to build dynamic buffers. With a dynamic buffer, you can select the table for your buffer at run time. The buffer fields enable you to select the fields to be displayed.
To launch this module, choose the Dynamic Buffer/Temp Table button on the SportsPro main window. The Dynamic Buffer dialog box appears:
This module demonstrates a non-SmartObject approach to separating the user interface and business logic portions of an application. The initializeObject procedure runs a procedure on the AppServer partition that populates the list of database tables. Choosing the Open Query button runs another procedure on the AppServer partition. That procedure populates a dynamic temp table and passes back the handle for that temp table.
Table 2–4 describes the major objects used in the Dynamic Buffer/Temp Table module.
 
Table 2–4: Components of the Dynamic Buffer/Temp Table module 
Object or filename
Object type
Function
wquery.w
SmartWindow
Serves as a container for the other objects in the module
gettablefields.p
Procedure file
Runs during the initializeObject internal procedure to populate the selecttable selection list
selecttable
Selection-list
Lists the available tables
getnewfields.p
Procedure file
Runs when a table is selected to populate the selectfld selection list
selectfld
Selection-list
Lists the available fields in the selected table
btnadd
Button
Adds the field selected in the selectfld selection list to the selectfld2 selection list through the additem internal procedure
btnremove
Button
Removes the selected field from the selectfld2 selection list through the removeitem internal procedure
selectfld2
Selection-list
Lists the fields that will be displayed when the query runs
btnopenqry
Button
Runs getrecords.p and receives the handle of the dynamic temp-table that procedure creates; then it runs the displayflds internal procedure to populate EDITOR–1
getrecords.p
Procedure file
Creates a dynamic temp-table and populates it based on the fields listed in the selectfld2 selection list
EDITOR–1
Editor
Displays a single record from the dynamic temp-table
btnfirst
Button
Navigates to the first row of the result set
btnnext
Button
Navigates to the next row of the result set
btnprev
Button
Navigates to the previous row of the result set
btnlast
Button
Navigates to the last row of the result set
For more information on building dynamic buffers and temp tables, see the chapters on using dynamic buffers and on using temp tables in OpenEdge Getting Started: ABL Essentials.
Drag and Drop module
ABL can read the names of files that an end user drops onto certain widgets. With this functionality, the end user can populate widgets, like selection lists, with a list of files. ABL can also use the filenames to retrieve the files and open them in appropriate widgets. Using these techniques, you could save your users time by allowing them to load data into your program by dragging a filename from the Windows Explorer or Desktop onto a widget in your application.
To launch this module, choose the Drag and Drop button on the SportsPro main window. The Drag and Drop dialog box appears:
Implementing this technique is simple. You set the DROP–TARGET attribute on the property sheet of a selection list or editor widget and code the trigger event. For images, the DROP–TARGET attribute is set on the frame that holds the image. When a file is dropped on an object with the DROP-TARGET attribute enabled, the DROP–FILE–NOTIFY event fires.
Note: If you cannot click on an object, it is probably behind another object in the window’s layout. Use the Layout menu to move the top object back, or use the List Objects dialog box to access the bottom object.
Table 2–5 describes the major objects used in the Drag and Drop module.
 
Table 2–5: Components of the Drag and Drop module 
Object or filename
Object type
Function
wdragdrop.w
SmartWindow
Serves as a container for the other objects in the module
fMain
SmartFrame
Acts as the drop-target for image files; it reads the filename and then displays the image.
SELECT–1
Selection-list
Acts as the drop-target for filenames; it reads the filenames and then adds them to the list of selections.
EDITOR–1
Editor
Acts as the drop-target for text files; it reads the filename and then opens the file in the editor.
For more information on how drag and drop works, see the entries for the DROP–TARGET attribute, the END–FILE–DROP( ) method, the GET–DROPPED–FILE( ) method, the DROP–FILE–NOTIFY event, and the NUM–DROPPED–FILES attribute in OpenEdge Deployment: Managing ABL Applications.
Resizable Dynamic Browser
ABL supports end users changing the way the data is displayed in a data browser. The changes occur only in the user interface; they do not change field widths or column positions in the data source.
To launch this module, choose the Resizable Dynamic Browser button on the SportsPro main window. The Find Order dialog box appears:
In a normal browser, these attributes are set on the Advanced Properties dialog box in the AppBuilder at design time. Because the browser is dynamic, the attributes have to be set programmatically. The browser also uses the dynamic filters supplied as part of the ADM.
Table 2–6 describes the major objects used in the Resizable Dynamic Browser module.
 
Table 2–6: Components of the Resizable Dynamic Browser module
Object or filename
Object type
Function
wfndord.w
SmartWindow
Serves as a container for the other objects in the module.
dorder
SDO
Queries the Order table to retrieve all order records for the query. The module accepts the handle for the instance of dorder 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 seldspflds selection list.
dynfilter
SmartFilter
Enables the user to dynamically filter the records shown in the browser.
seldspflds
Selection-list
Lists the fields in the Order table that can be displayed in the browser.
BUTTON-2
Button
Creates a dynamic browser instance from the master file, adm2\dynbrowser.w, using information from the filter and selection list.
dynbrowser
SmartDataBrowser (SDB)
Enables the user to browse a result set created dynamically from dorder and information from the filter and selection list.
tglbrowserresizable
Toggle-box
Sets the RESIZABLE and SELECTABLE attributes of the browser.
tglcolmovable
Toggle-box
Sets the COLUMN–MOVABLE attribute of the browser.
tglcolumnresizable
Toggle-box
Sets the COLUMN–RESIZABLE attribute of the browser.
tglrowresize
Toggle-box
Sets the ROW–RESIZABLE attribute of the browser.
SmartDataObject module
One of the SmartObjects that OpenEdge uses to support distributed applications is the SmartDataObject (SDO). The SDO manages the query, validation, and transaction logic in one object. One of its important features is that it can run locally, or be split between the client and AppServer in a distributed environment. Separating user interface from business logic is one of the keys to creating distributable applications. The SDO also provides an open interface that you can access in an Open Client environment as a set of non-ABL objects.
To launch this module, choose the SmartDataObject button on the SportsPro main window. The Item Maintenance dialog box appears:
The SDO in this module queries the database and sends the records to a SDB and a SDV. The SDB and SDV are thin objects. They display data and accept changes to fields, but do not contain data update or validation logic. The SDO carries out the update and validation tasks on the server side.
Table 2–7 describes the major objects used in the SmartDataObject module.
 
Table 2–7: Components of the SmartDataObject module
Object or filename
Object type
Function
wmntitem.w
SmartWindow
Serves as a container for the other objects in the module
ditem
SDO
Queries the Item table to retrieve item records
getcategory.p
Procedure file
Runs during the initializeObject internal procedure to populate the seldspflds selection list
bitem
SDB
Enables the user to select an item record
lcategory1
Combo-box
Filters the items shown in bitem to those matching the selected category
vitem
SDV
Displays detailed information for the item currently selected in bitem
pnavico
SmartPanel
(navigation)
Controls navigation for the result set from ditem
pupdsav
SmartPanel
(update)
Controls record update functions on the result set from ditem
Note: The SmartDataObject module also runs when you choose the ViewItem Maintenance menu option in the SportsPro Order Tracking System.
For more information on SDOs, see the chapter on SmartObjects in OpenEdge Development: ADM and SmartObjects.
SmartDataField module
The SmartDataField (SDF) gives you a method to customize how particular pieces of data are displayed. You might use the SDF as a calculator to update an integer field, or as an editor with cut, copy, and paste buttons to update a character field. In this module, a SDF displays a date field as a calendar. Choosing a new date in the calendar changes the value in the field.
To launch this module, click the SmartDataField button on the SportsPro main window. The Order Update dialog box appears:
SDFs work with SDVs. You create a master for the SDF that you want to use. Then you drop an instance of it onto an appropriate field in a SDV to create the necessary links.
Table 2–8 describes the major objects used in the SmartDataField module.
 
Table 2–8: Components of the SmartDataField module 
Object or filename
Object type
Function
wordupd.w
SmartWindow
Serves as a container for the other objects in the module.
dorder
SDO
Queries the Order table to retrieve all order records.
vorder2
SDV
Displays the contents of several fields of the selected order record.
sdfcal
SDF
Displays the value of the OrderDate, PromiseDate, and ShipDate fields in the selected record. The SDFs also provide a more convenient method for changing the values than a standard fill-in field.
pnavico
SmartPanel
(navigation)
Controls navigation for the result set from dorder.
pupdsav
SmartPanel
(update)
Controls record update functions on the result set from dorder.
For more information on SDFs, see the chapter on SmartObjects in OpenEdge Development: ADM and SmartObjects.
Publish and Subscribe module
The Publish and Subscribe module demonstrates the ABL named‑event functionality. The module uses two event publishers, publisher1.w and publisher2.w, and two event subscribers, subscriber1.w and subscriber2.w. A driver procedure, subpub.p, starts the publisher procedures as persistent procedures. The driver then starts the subscriber procedures, passing to them the handles for the persistent publisher procedures.
To launch this module, choose the Publish and Subscribe button on the SportsPro main window. The following dialog boxes appear:
The publish and subscribe functionality works like an e‑mail alias. When users subscribe to an e‑mail alias, they receive messages whenever messages are published to that alias. Other persistent procedures running in the same session can locate a procedure that generates an event of interest. The persistent procedures subscribe to that event by mapping the event to an internal procedure that is executed when the event occurs.
Table 2–9 describes the major objects used in the Publish and Subscribe module.
 
Table 2–9: Components of the Publish and Subscribe module
Object or filename
Object type
Function
suppub.p
Procedure file
Runs the four windows as persistent procedures and passes the handles for the publishers to the subscribers.
publisher1.w
SmartWindow
Serves as a container for the objects in it.
BUTTON–1
Button
Publishes a named event, “EventOne,” which causes the EventOne internal procedure to run in any subscriber for which it currently has a handle. It reports the number of subscribers to the event from the replies it receives.
BUTTON–2
Button
Publishes a named event, “EventTwo,” which causes the EventTwo internal procedure to run in any subscriber for which it currently has a handle.
publisher2.w
SmartWindow
Serves as a container for the objects in it.
BUTTON–1
Button
Publishes a named event, “EventOne,” which causes the EventOne internal procedure to run in any subscriber for which it currently has a handle. It reports the number of subscribers to the event from the replies it receives.
BUTTON–2
Button
Publishes a named event, “EventTwo,” which causes the EventTwo internal procedure to run in any subscriber for which it currently has a handle.
subscriber1.w
SmartWindow
Serves as a container for the objects in it.
BUTTON–3
Button
Subscribes to both named events in publisher1.w and to “EventOne” in publisher2.w.
BUTTON–4
Button
Unsubscribes from “EventOne” in publisher1.w.
BUTTON–5
Button
Unsubscribes from “EventOne” in both publishers.
subscriber2.w
SmartWindow
Serves as a container for the objects in it.
BUTTON–6
Button
Subscribes to “EventTwo” in both publishers and to “EventOne” in publisher1.w.
For more information on publishing and subscribing to named events, see the chapter on user-defined functions in OpenEdge Getting Started: ABL Essentials.
SmartB2B and SonicMQ module
This module demonstrates the use of several new SmartObjects to link different businesses using a “Publish and Subscribe” technique. You might also do this using a “Point-to-Point” technique. A store can transmit its orders to its supplier as XML documents in a previously agreed upon format. The supplier can receive the XML document and translate the data into a form compatible with its own applications.
To launch this module:
1. Click the SmartB2B and SonicMQ button on the SportsPro main window. A window appears explaining the environment that you need to set up to run this module.
2. Follow the instructions to launch the first application in this module. The Send Purchase Order dialog box appears:
3. Follow the instructions to launch the second application in this module. The Order Fulfillment dialog box appears:
Each of the applications that make up this module contains a SmartBusinessObject (SBO) that organizes the data streams of several SDOs. A SmartB2BObject takes the data from the SBO and runs it through a mapping file generated by the OpenEdge XML Mapping Tool. The XML message is then sent out by a SmartProducer and transmitted using SonicMQ. The file is received at the other end by a SmartConsumer and passed to its SmartB2BObject to be decoded with another XML mapping file.
Table 2–10 describes the major objects used in the SmartB2B and SonicMQ module.
 
Table 2–10: Components of the SmartB2B and SonicMQ module
Object or filename
Object type
Function
gb2bintro.w
SmartDialog
Introduces the requirements for running this module. If you choose OK, wstore.w runs.
wstore.w
SmartWindow
Serves as a container for the other objects in the retailer’s application.
sbopo
SmartBusinessObject
Organizes the data streams of dcust, ditem, dpo, and dpoline into a single logical data stream.
dcust
SDO
Queries the Customer table to retrieve all customer records, and supplies them to sbopo.
ditem
SDO
Queries the Item table to retrieve all item records, and supplies them to sbopo.
dpo
SDO
Queries the PurchaseOrder table to retrieve all purchase order records, and supplies them to sbopo.
dpoline
SDO
Queries the POLine table to retrieve all purchase order line records, and supplies them to sbopo.
vpo
SDV
Displays fields from sbopo.
dynbrowser
SDB
Displays details of the line items in the record selected from sbopo.
pnavico
SmartPanel
(navigation)
Controls navigation within the result set from sbopo.
BUTTON–1
Button
Runs sendMessage( ) in sbbpo.
sbbpo
SmartB2BObject
Using the predetermined schema, creates an XML message containing the data from the current record and passes it to dynproducer.
dynproducer
SmartProducer
Sends the XML message to the SonicMQ broker for delivery to the remote procedure.
wsupplier.w
SmartWindow
Serves as a container for the other objects in the supplier’s application.
Note: Since this module demonstrates how separate applications can exchange data, you have to start this application in a separate session.
dynconsumer
SmartConsumer
Receives the XML message from the SonicMQ broker and passes it to sbborder.
sbborder
SmartB2BObject
Reads the data from the XML message and uses the predetermined schema to transform the XML message into a record in sboord.
sboord
SmartBusinessObject
Organizes the data streams of dord and dordline into a single logical data stream.
dord
SDO
Queries the Order table to retrieve all order records, and supplies them to sboord.
dordline
SDO
Queries the OrderLine table to retrieve all order line records, and supplies them to sboord.
vord
SDV
Displays fields from sboord.
dynbrowser
SDB
Displays details of the line items in the record selected from sboord.
pnavico-2
SmartPanel
(navigation)
Controls navigation within the result set from sboord.
For more information on using SmartB2B objects and integrating OpenEdge applications with SonicMQ, see the chapter on SmartObjects in OpenEdge Development: ADM and SmartObjects and the chapter on accessing SonicMQ messaging from the ABL in OpenEdge Development: Messaging and ESB.
The SportsPro sample application modules that you examined are useful starting points. In them, you can see how to make better use of OpenEdge’s capabilities in your applications. To see how to integrate separate modules into a functioning application, you can now look at the last part of the sample application, the Order Tracking System. The Order Tracking System integrates most of the modules you have just examined and several others into a finished application.