Release 10.1A: OpenEdge Development:
Progress Dynamics Getting Started

> ## Adding a dynamic Combo to your viewer

> The most common addition to a viewer is a selection list for a foreign key field. A foreign key field is a field in one table that matches a unique key field in another table. An example in the DynSports database is the SalesRep field in the Customer table, which is a foreign key for the SalesRep key field in the SalesRep table.

> Progress Dynamics provides two different visualizations for choice lists: a dynamic Combo and a dynamic Lookup. Both are based on the SmartDataField (SDF), which provides a specialized representation of a single field in a viewer. The SDF retrieves the possible values for a field and visualizes them as either a combo box (dynCombo) or a button (dynLookup), which launches a maintenance window.

> Part of the best practices recommendation for database design in Progress Dynamics is to include a unique key field on each table that is used only as a relationships target. These are the object (`_obj`) fields. Generally, you do not want the object field that uniquely identifies a table to appear in visual objects for that table. However, they are the recommended targets for SDFs.

> | To add a dynamic Combo for Sales Reps to the viewer:

> 1. Right-click on the SmartDataField icon on the Object Palette. A pop-up menu of specific types of SmartDataFields appears.

> 2. Select DynamicCombo from the list. The cursor changes to represent a field object .

> 3. Click on the Sales Rep field in the viewer to replace it with the dynamic Combo object. After the AppBuilder automatically sets up the proper connections, the Choose Existing SmartDataField dialog box appears:

> 4. Choose the Create New SDF button. The SmartDataField Maintenance window appears:

> 5. Type SalesrepCombo in the SmartDataField field and Sales rep dynamic combo in the Description field.

> 6. Select ds-Entity for the Product module.

> 7. Select Database query in the Data source radio set and select the Use cache toggle box.

> These options control if and how the data in dynamic combos and lookups is cached. Caching this data can improve the performance of your application. However, you should not use caching without due consideration. For more information on this feature, see OpenEdge Development: Progress Dynamics Basic Development .

> 8. Double-click in the Specify base query string editor. The Query Builder appears:

> This SDF uses a simple query that you could have typed directly into the editor. However, the Query Builder is useful for creating more complex queries. The query should always include the `NO-LOCK` keyword. Because a combo box cannot update the table, it only needs to read values and should not lock the table. Locking tables unnecessarily can have a major impact on performance.

> 9. Select dynsports in the Database combo box, if necessary.

> 10. Select arm_salesrep in the Available Tables list.

> 11. Choose the Add>> button.

> 12. Choose OK. The SmartDataField Maintenance window refreshes with the details of the table.

> 13. Type 1 in the Display seq field for arm_salesrep.salesrep_code in the browse. By setting the values in this browse, you can choose which fields to display in the SDF and in what order to display them. You should choose fields that let a user easily select the correct value. For this combo, the Sales Rep code and name are good choices.

> 14. Type 2 in the Display seq field for arm_salesrep.salesrep_name in the browse.

> 15. Select arm_salesrep.salesrep_obj for the Key field.

> 16. Type Sales rep for the Field label and Select Sales rep from list for the Tooltip on the Details tab. You can leave other fields in the property sheet at their default values, as shown:

> 17. Choose Save to save this definition as a named, reusable dynamic Combo, and exit the SmartDataField Maintenance window.

> 18. Make any final adjustments in the design window to the viewer layout, then choose Save in the AppBuilder toolbar. Your finished viewer should look something like this:

> 19. Close the viewer design window.

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