Progress
Programming
Handbook
Defining a Query for a Browse
By default, a query uses SHARE–LOCKs and it is not scrollable. Scrollable is the ability to move backward as well as forward in the query. The optimum query for a browse should use NO–LOCKs and be scrollable. When a browse is associated with a query (by way of the DEFINE BROWSE statement), Progress automatically changes the query to use the NO–LOCK and SCROLLABLE options.
Locking is an important topic with browse widgets. Since the browse widget is a tool for displaying data from multiple records, you do not want to tie up these records with SHARE–LOCKs. Even when you are working with updatable browse widgets, you will find that NO–LOCK is the best choice for the associated query. Functionality covered later in the chapter describes how to successfully update browse records that start in the NO–LOCK state.
Once you define the query, define the browse, and open the query, the browse and the query become virtually identical. The currently selected row and the results list cursor are in sync and remain so. When the user manipulates the browse, the user is also performing the same manipulation on the cursor of the results list. Many programmatic actions performed on the results list or the browse automatically update the other, although this is not universally true. (You could say that learning all the subtleties of the browse involves learning what occurs by default, what you have to manage, and what behaviors you can override.)
As a rule, a query associated with a browse should be used exclusively by that browse. While you can use GET statements to manipulate the database cursor, the results list, and the associated buffers, you run the risk of putting the browse out of sync with the query. If you do mix browse widgets and GET statements with the same query, you will have to use the REPOSITION statement to manually keep the browse in sync with the query.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |