skip to main content
OpenEdge Development: AppBuilder
Data-Display/Capture Objects : SmartSelects
 
SmartSelects
The SmartSelect is a predefined SmartDataField object that represents a self‑populating set of choices. You would typically use a SmartSelect to choose a new value for a field from among a relatively small group of possibilities drawn from a related table.
The SmartSelect object is data‑driven. Most widgets used in an application have their values embedded as data within the program itself, so that changing the values in any way typically requires recompilation. Since the SmartSelect obtains its values from the database being modified, instead, recompilation is rarely required.
Some examples of the kind of situation for which a SmartSelect would be appropriate:
*Assigning a different sales rep to an account. Typically a company has a small number of sales reps, each of whom calls on many accounts.
*Changing a customer’s credit limit, if the possible choices are few. For example: discredited; credit hold; credit not requested; $10,000; $50,000; $100,000; unlimited.
*Changing some demographic value in a personnel record. For example: single, partnered, married, separated, divorced, widowed, deceased, dependent.
*Setting the circulation status of a book in a library‑management system. For example: on‑order, reference, reserved, available, checked‑out, bindery, lost.
*Picking a customer number for use in order‑entry. Since customer numbers are important to the seller rather than the customer, customers rarely remember them.
You can configure each SmartSelect instance to represent its set of values using your choice of four different widgets: combo box (the default), radio set, selection list, or a browse that opens in its own popup window. Of those four, only the browse is capable of handling a large or unpredictable number of values. You might find it helpful to experiment before deciding on a representation.
Placing a SmartSelect instance
Start with the FileOpen menu option.
To use a SmartSelect as a field in a SmartDataViewer:
1. Choose FileOpen and select the SmartDataViewer master you intend to modify. Click OK. The master opens in a workspace window, as illustrated here:
2. Create, if necessary, and place the SDO that will supply values to the SmartSelect.
3. Click on the SmartDataField in the Object Palette.
4. Choose SmartSelect from the menu that opens.
5. Position your mouse cursor over the field you are replacing, and click to make the replacement. The SmartSelect representation appears in place of the original fill-in:
6. An Advisor should now appear and offer to add the Data link from the SDO to the SmartSelect. Agree to the offer.
7. If no Advisor appears, open the SmartLink Editor and add it yourself.
8. Right-click the instance and choose Instance Properties from the menu. Configure the instance. See the “Configuring a SmartSelect instance” section for information.
Configuring a SmartSelect instance
The SmartSelect has a relatively complex Instance Properties dialog box, as shown:
Data source
This section identifies the SDO that will feed the SmartSelect object. You cannot enter the filename of the SDO directly; AppBuilder fills in this field as part of creating the SmartLinks, once you place the SDO in the viewer workspace.
You can subset the data that the SmartSelect displays. Type a subsetting expression into the Filter field—for example:
 
CreditLimit > 10000
The SmartSelect will then display only the subset of items that conform to that restriction.
Data
This section describes the field being replaced, and the identifying characteristics of its replacement:
*External field — Identifies the field in the SmartDataViewer that you are replacing. This identification is read‑only, supplied for your information only.
*Key field — If the replacement data stream has more than one field, use this combo box to select the field that will appear in place of the original. Be certain to select the correct one.
For example, the State table in the sample database has three fields: State, StateName, and Region. If you use a SmartSelect fed from the State table to update the Customer.State field, the only correct choice for the key field would be State.State, since that is the related field. If you choose StateName or Region instead, confusion is almost certain to result, later.
*Displayed field — If the replacement data stream has more than one field, use this combo box to select the field that the user will see. To continue the State example, you might prefer to display the more recognizable StateName field. That would be a more user‑friendly choice than displaying the cryptic two‑character post‑office abbreviation from the State field itself, even though it is that two‑letter code that you will store.
*Event on change — You can declare a name for the event to be experienced when the value of this field changes. This allows you to write an appropriate event‑handling procedure. The name you define is local to the object. See OpenEdge Development: ADM and SmartObjects and the for further information.
*Edit browser columns — Active only when the field is to be represented as a Browse widget. Choosing this button opens the standard field‑selection dialog box so that you can select the fields to be displayed.
Properties
This section presents three important behavioral properties:
*Enable — Normally set. Clearing this box prevents the SmartSelect from enabling itself even when the other fields of the SmartDataViewer enable themselves.
*Display — Normally set. Clearing this box prevents the SmartSelect from displaying data even when the other fields of the SmartDataViewer display data.
*Sort — Normally set. Clearing this box causes the items to appear in unsorted order. Normally the visible fields appear sorted on the displayed field.
Optional
This check box is normally cleared. Setting this box means that the associated field need not have a value.
You can specify the text that represents that nonvalue; the default is <none>. Note that this text does not necessarily appear at the top of your list of choices. If you wish it to appear as the first item in the list, you must either explicitly make it the first item in the source (for unsorted lists) or begin with some character, such as the angle bracket (<), that the sort operation will move to the top of the list.
Visualization
This section allows you to specify how the SmartSelect list will represent itself at run time. The choices are:
*Browser — The browser representation is the best choice for handling lists that are known to be very large or are of unknown size. This representation initially appears in a closed state, under an iconic button next to the current value of the field:
Clicking the button opens the list of items as a browse in a separate window. Click on the Edit Browser Columns button to choose what fields to display. Set the number of lines to display by entering an integer in the Inner Lines field.
*Combo box — Default. This representation is configured as a drop-down list by default. For a description of the three types of representation, see the “Combo boxes” section.
Set the number of lines to make visible in the list by entering an integer in the Inner Lines field.
*Selection list — Selection lists generally take up more space than combo boxes because you must specify their size at design time. Note that setting the Inner Lines field property has no effect on the visible size of the widget. You must resize it manually by dragging the handles.
*Radio set — Best suited to very small, fixed‑size data sets that can be represented as short labels. You can specify a vertical (default) or horizontal orientation.
Displayed field attributes
Specify the characteristics of the field you display as a prompt to the user:
*Label — Specify the label, if any, to display with the SmartSelect. The SmartSelect object does not inherit the label of the SmartDataViewer field it replaces. You can set the Data Source check box to use the schema name of the field, or type in a label of your choice.
*Browse title — Active only when browse is the representation type. You can set the title string that the browse widget will display.
*Datatype — Read‑only. Displays the underlying data type of the displayed field from the schema definition.
*Format — Displays the field descriptor from the schema definition. Clear the Data Source check box if you have reason to modify this descriptor.
*Tooltip — Enter the string the SmartSelect will display as the MS‑Windows Tooltip.
*Help ID — If you will offer context‑sensitive help for this object, enter a unique integer identifier here.
Geometry
Displays the origin and size of the SmartSelect representation in character units. You can set these values here, or in pixel units in the Advanced Properties dialog box.
Example: assigning a new sales rep
This example illustrates how to use a SmartSelect instance to update the SalesRep field in a Customer record. The tables it uses are found in the sports2000 database.
To use a SmartSelect instance to update the SalesRep field in a Customer record (agree to all Advisor suggestions for links):
1. Create a SmartWindow as the application workspace. Save it.
2. Create the SDO master that will pump the Customer records. Choose the Customer table. Use only the Name, Address, City, and SalesRep fields from the Customer table. Save the master. For example:
3. Place into the application workspace an instance of the Customer SDO you just created:
4. Create the SDO master that will feed the SmartSelect field. Choose the Salesrep table. Use only the SalesRep field from that table. Save the master:
5. Create the SmartDataViewer master that will display the Customer records. Include all four of the fields. Save the master, but leave its workspace open:
6. Place an instance of the Salesrep SDO into the master SmartDataViewer workspace:
7. Replace the SalesRep field in the SmartDataViewer with a SmartSelect instance. Resize the instance for cosmetic reasons:
8. Save the changes in the SmartDataViewer. Place an instance of the SmartDataViewer into application workspace:
9. Place Navigation and Update SmartPanels into the application workspace:
10. Run the workspace. You should be able to assign a new sales rep to any account by choosing from the combo box, as shown: