skip to main content
OpenEdge Development: AppBuilder
Data-Display/Capture Objects : Static SmartDataBrowser
Static SmartDataBrowser
The static SDB you use in your application is an instance of a master object that you create. Each master SDB is designed to cooperate with a particular SDO master, exchanging a well‑defined set of data fields in a particular order.
Creating a SmartDataBrowser master
The first step in defining a new SDB master is always to identify the source of the data stream. Because of this dependency, you must first create your SDO, then create the SDB. See the “Creating a SmartDataObject master” section for information about that process.
To create an SDB master:
1. Start the SmartDataBrowser Wizard by clicking on the SmartDataBrowser in the Object Palette.
2. Click New in the Choose dialog box. The SmartDataBrowser Wizard appears:
3. When you have finished reading the introductory text, click Next. The Page 2 dialog box appears:
4. Click Browse and select the appropriate SDO master. Alternately, you can create an SDB against a SmartBusinessObject (SBO) or a temp-table’s definition in an include file.
5. Click Next. The Page 3 dialog box appears:
6. Click Add Fields. The Multi‑Field Selector dialog box appears:
7. The fields Available for display appear in the left-hand list. Select those you wish the SDB to display and click the Add button to move them to the Selected list in the right-hand window. If you make a mistake, click the Remove button.
When you have finished selecting fields, you can reorder them using the Move Up and Move Down buttons. When they are in the order you want them displayed, click OK. The Selector dialog box closes and the list of selected fields appears in the Fields to display section of the wizard, as shown:
8. Click Next to advance to the wizard’s final page. If you have successfully defined a data source and selected the fields to display, you will see “Congratulations!”. If you do not, click Back and make any necessary changes:
9. Click Finish to dismiss the wizard and reveal the new SDB master, if it was not already visible.
10. Choose FileSave and give the new master a descriptive filename. Note that SDB filenames conventionally begin with b:
The new master object is now available for your use.
Configuring SmartDataBrowser properties
SDBs have properties associated both with their browse component and with their nature as a procedure‑based object. You can make a number of changes to those settings, if the default values do not meet your needs.
To open the property sheet associated with the Browse component:
1. Choose FileOpen, select the master you wish to configure, and click OK. The SDB object appears:
2. Click on the object to select it, if necessary, and choose ToolsProperty Sheet. The Property Sheet dialog box appears:
Minimal configuration
Although you can accept many of the default settings, you might wish to make two changes to individualize the object. Note that the following changes will apply to all created instances:
*Change the identifier to more closely reflect the object’s nature.
*Add a title string, if you plan to allow the Browse component to display a title bar.
Query and fields
Since the SDB uses the data stream from an SDO, you can change only the fields and their ordering. The Query button is disabled because the query belongs to the SDO, not the browse widget:
*Choosing the Fields button starts Column Editor and allows you to modify the columns this SDB will display. For information about how to use Column Editor, see the “Selecting database fields for browsing” section. Note, however, that the Column Editor for the SDB includes extra options to configure how columns display.
*By default, all columns can be scrolled horizontally, if there are too many columns to display at once. You can choose to lock the leftmost columns in place, so that scrolling does not affect them. Enter in the Locked Columns box the number of columns you want to freeze in place.
Caution: If you lock more columns than will fit in the browse’s viewable width, you effectively disable the horizontal scroll bar, because all scrolling will take place out of sight to the right.
*When displaying a vertical scroll bar, the system tries to size the scroll bar’s thumb slider to reflect the total number of lines in the data stream. The larger the number of lines, the smaller the thumb. However, that thumb size is based on the number of records being batched by the SDO, not on the total number in the stream. In general, the total number of records in the stream will be larger. When that is the case, the system cannot correctly size the thumb.
If you can predict, even approximately, the total number of records in the data stream, you can improve the accuracy of the scroll bar’s appearance. Enter your estimate in the Max Data Guess field.
*Type into the Tooltip field the identifying text that you want the system to display whenever the mouse cursor hovers over this SDB.
You can set the exact origin and size of any SDB instance created from this master. Set the values, in character units, in the appropriate fields. You can choose whether the origin is measured at the upper‑left corner (the default) or the upper‑right corner.
If you prefer to use pixels rather than character units, click Advanced and set the values in that dialog box instead.
For more information on all the settings on the property sheet, see the online help.
Advanced properties
Click Advanced. The Advanced Properties dialog box appears:
You can make a number of changes to the SDB’s appearance and behavior by changing the default settings in this dialog box:
*Help — Text in this field displays in the status bar of the parent window when the SDB has the focus. If the parent window has no status area, this text will not display.
*Private Data — AppBuilder writes out the contents of this field as the value of the object’s PRIVATE‑DATA attribute. You can write code to read and operate on that value in any way that meets your needs.
*Generated Code Layout Unit — Controls whether AppBuilder describes the position and size of this SDB in character or pixel units when it generates source code.
*Geometry - Pixels — Expresses the origin and size of this widget in pixels. You can set a particular origin and size for the object here rather than interactively, if you wish. You can also choose to have the origin measured at the upper‑right rather than the upper‑left corner.
*Column Movable — Normally cleared. Setting this check box allows the user to reorder the columns by dragging.
*Column Resizable — Normally cleared. Setting this check box allows the user to resize the columns interactively. Resizing the column has no effect on the actual field widths.
*Column Searching — Normally cleared. Setting this box in read‑only browsers allows the user to search in an individual field across all records. Updatable browsers allow such searching by default.
The search is started by clicking the desired column title and typing the letter for which to search. No prompt appears for the letter. The browser scrolls its window to bring into view and make current the next record, if any, in which the search field data begins with the typed‑in letter.
*Movable — Normally cleared. Setting this check box and the Selectable check box allows the user to move the entire SDB object around within the bounds of the enclosing frame.
*Resizable — Normally cleared. Setting this check box and the Selectable check box allows the user to change the size of the SDB object, within the limits of the enclosing frame.
*Row Resizable — Normally cleared. Setting this check box allows the user to change the vertical size (height) of the rows by dragging a horizontal separator line.
*Selectable — Normally cleared. Setting this check box allows the user to select the SDB object.
Editing a SmartDataBrowser master
Any modular system must have and enforce strict data‑exchange requirements if it is to avoid possible data corruption and loss. You can always update the field selections in your SDB to reflect your changing needs, though you might also need to make corresponding changes to the associated SDO (see Table 10).
To edit your SDB master:
1. Choose FileOpen and select the source file (for example: bSampleSDB.w). The SDB object appears:
2. Open its property sheet and make any necessary changes.
3. Save your changes and close the SDB master.
Creating and placing a SmartDataBrowser instance
Once you have an SDB master designed that will display the data you need, you can reuse it indefinitely in your applications.
To add an SDB to your organizer workspace:
1. Click on the SDB tool icon in the Object Palette. When the Choose dialog box opens, select the appropriate master and click OK.
2. Position the cursor over the workspace at the point where you want the upper‑left corner of the widget to appear. Click, and the new SDB object appears.
3. AppBuilder immediately opens an Advisor window if it finds opportunities to create SmartLinks to other objects. Accept the Advisor’s recommendations, if they seem appropriate.
4. Drag the edges of the new SDB object to position and resize it.
5. Configure the object’s instance properties. See the next section.
6. Save your work.
Configuring a SmartDataBrowser instance
There are several properties you can configure in an SDB instance, if the default values do not meet your needs.
To configure the properties in an SDB instance when the values do not meet your needs:
1. Right-click on the instance and choose Instance Properties. The following dialog box appears:
2. To disable the object at startup, clear the Enable box.
3. If multiple layouts are defined, choose one from the list.
4. To hide the object at startup, clear the View box.
5. To enable scrolling to the last record in the data stream, set the Scroll Remote Results List checkbox. You might also need to write some code. For details, see the “Scrolling to the last record in the data stream” section.
6. Click OK and save your work.
Scrolling to the last record in the data stream
Conventionally, the size and position of the thumb slider within a scrollbar provides the user a hint about the overall size of the document being examined, and the position of the viewport within that document. The ratio of thumb size to scrollbar size indicates how much of the whole document is currently visible. The position of the thumb within the scrollbar’s length represents how far the visible portion is from the beginning and end of the document.
In the case of the SDB and its basic counterpart, the document being examined is actually a data stream. Typically, that data stream will contain many records. Many more records, in general, than are practical to buffer. But if there are more records than are buffered, the size and position of the thumb will reflect the buffer, not the whole data stream. Moving the thumb to the bottom of the scrollbar track brings into view the last record in the buffer, not the last record in the data stream.
This can be confusing to the user of your application.
To fix the problem in your SDB:
1. Click the SDB’s Menu button and select Instance Properties. The following dialog box appears:
2. Set the Scroll Remote Results List check box.
3. Save your work.
If you have a trigger defined for the ROW-DISPLAY event, you must modify it. Follow these steps:
1. Right-click the instance and choose Edit Master from the context menu. The master workspace appears (its appearance may be different):
2. Select the workspace if necessary and open a Section Editor window. Create a new procedure, for example OldRowDisplayHandler, and move the code from your ROW-DISPLAY handler into the new procedure.
3. Create a new function as an override for rowDisplay. Put in it a call to the procedure you just created, followed by a RUN SUPER statement. If you name your procedure OldRowDisplayHandler, your function body would look like the following:
RUN OldRowDisplayHandler. /* run original local code */
RUN SUPER.                /* run the handler in the super procedure*/
4. Open your local ROW-DISPLAY trigger in the Section Editor. It should now have no code in it, because you moved that code to the new procedure you created.
5. Add the following line as the new body of your local trigger:
RUN rowDisplay. /* run local override of super-procedure handler*/
6. Save your work.
Now, when the user drags the thumb to the bottom of the scroll bar, bringing the last record in the buffer into view, the browser requests a new batch of records from the Data-Source. When the new batch is received, the browser repositions its thumb to account for the new total record count. Thus, the first time a new batch is requested, the thumb will in general reposition to the middle of the scrollbar because the former last record is now in the middle of the buffer. The second read will create a total of three batches, with the thumb positioned at the two-thirds point, and so forth.