Release 10.1A: OpenEdge Development:
Progress Dynamics Getting Started

> ## Adding a dynamic Lookup to a viewer

> A dynamic Lookup can represent a larger set of records than you can display in a dynamic Combo. In this exercise, you add a dynamic Lookup object to the dynamic viewer for the Order table. The dynamic Lookup launches a separate dynamic browse of Customer records. Using the dynamic Lookup, you can assign a customer to the selected Order.

> ##### Laying out the Order viewer

> | To add the dynamic Combo to the Order viewer:

> 1. Choose File Open Object in the AppBuilder main window.

> 2. Select the dynamic Viewer, artorviewv, then choose Open.

> 3. Rearrange the fields in the design window. Lay out the fields any way you like, but leave some room to the right of the object fields, as shown:

> 4. Right-click on the SmartDataField icon on the Object Palette and select DynamicCombo.

> 5. Click on the Sales Rep field to replace it with the dynamic Combo object. The Choose Existing SmartDataField dialog box appears.

> 6. Double-click SalesrepCombo on the Details tab. The SmartDataField Maintenance dialog box displays the properties for this new instance of the Sales Rep combo.

> 7. Choose Save and exit the dialog box.

> You have just reused the dynamic Combo that you created in the "Adding a dynamic Combo to your viewer" section.

> ##### Adding a Customer dynamic Lookup

> | To add a dynamic Lookup for customers to the viewer:

> 1. Right-click on the SmartDataField icon on the Object Palette and select DynamicLookup.

> 2. Click on the Customer field in the viewer to replace it with the dynamicLookup object. After the AppBuilder automatically sets up the proper connections, the Choose Existing SmartDataField dialog box appears:

> 3. Choose the Create New SDF button. The SmartDataField Maintenance dialog box appears:

> 4. Type CustomerCodeLookup in the SmartDataField field and Customer code dynamic lookup in the Description field.

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

> 6. Select the Use cache toggle box.

> 7. Type the following query in the Specify base query string editor:

>     FOR EACH arm_customer NO-LOCK INDEXED-REPOSITION

> Since this Lookup will not update the table, the query should include the `NO-LOCK` keyword. The use of the `INDEXED-REPOSITION` keyword is recommended for data access in a stateless environment.

> 8. Choose the Refresh button. The remaining area of the property sheet is filled in with default choices for the `arm_customer` table, as shown:

> 9. On the Details tab, select arm_customer.customer_obj in the Key field combo.

> 10. Select arm_customer.customer_name in the Displayed field combo. This is the field whose value shows in the dynamic Lookup.

> 11. Type Customer for the Field label.

> 12. Select the following fields in the browse and set their Display Sequences as listed. These fields will display in the Customer browse that the dynamic Lookup launches:

> Field name | Display sequence
> --- | ---
> arm_customer.customer_code | 1
> arm_customer.customer_name | 2

> You can sort on a browse column by clicking on the column header. This screen shot shows the browser sorted by the Browse Sequence column after assigning the sequence values:

> 13. Select arm_customer.customer_balance in the browse.

> In addition to showing fields in the Lookup browse window, you can display one or more fields of the related table on the viewer. You will add a field that displays the customer’s balance.

> 14. Type YES in the Link field column.

> Normally, you also map each Link Field to a local variable in the viewer where the field’s value displays.

> 15. Type fiCustomerBalance, the field you will define to display the customer’s balance, in the Linked widget column, as shown:

> Note: The fi prefix is a naming convention for a fill-in.

> 16. Choose the Other tab.

> 17. Type armcufullo for the Maintenance SDO and oeCustFoldWin for the Maintenance object. You will build a browse window called oeCustFoldWin in the "Creating folder windows" section. Since it does not exist in the Repository yet, you cannot use the lookup and must be careful to spell the name correctly, as shown:

> Note: There is a useful shortcut for filling in many Lookup fields. If you type a few letters in the field and press the TAB key, the framework automatically searches for matching records. If only one match exists, the framework populates the field with that value. If there are more matches, the framework launches a dialog box filtered to display the matches.

> 18. Choose Save and exit the maintenance dialog box.

> 19. Select the Fill In from the Object Palette. This is the local field for the Linked Widget your defined for your Lookup.

> 20. Drop the fill-in onto the design window next to the binoculars icon representing the dynamic Lookup, as shown:

> 21. Type fiCustomerBalance for the Object and Balance for the Label in the AppBuilder main window, as shown:

> The dynamic Lookup makes the correct association with the Linked Widget name you specified when you defined your lookup and displays the `customer_balance` field in this position.

> 22. Double-click the field to bring up its property sheet. Users should not edit the contents of this field, so you must disable it.

> 23. Unselect the Enable toggle box, as shown:

> 24. Choose OK. Your Order viewer should now look something like the following:

> 25. Choose Save.

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