Kbase P107524: ADM2: How to populate a SmartDataBrowser in a called SmartDialog?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/27/2006 |
|
Status: Unverified
GOAL:
ADM2: How to populate a SmartDataBrowser in a called SmartDialog with the orders of a specific customer by passing the customer's number as an INPUT PARAMETER from the calling SmartWindow?
FIX:
1. Create a SmartDataObject against the Sports2000 Order table. Save it as dOrder.w.
2. Create a SmartDataBrowser against the above SmartDataObject. Save it as bOrder.w.
3. Create a SmartDialog. Remove its default OK, Cancel and Help Buttons.
4. Drop the SmartDataObject and the SmartBrowse created in steps 1 and 2 above on the SmartDialog. Save it gdialog.w.
5. UNCHECK the 'OpenQuery On Initialization' property box using the SmartDataObject's Instance Properties Dialog. This will save time by NOT opening the default query.
6. In the definition section of the SmartDialog, define an INPUT PARAMETER to receive the customer number from the calling SmartWindow:
DEFINE INPUT PARAMETER ipCustNum AS INTEGER.
7. In the definition section of the SmartDialog, define a CHARACTER variable to store query's new WHERE clause:
DEFINE VARIABLE cNewWhere AS CHARACTER NO-UNDO.
8. Create an override for the initializeObject of the SmartDialog with the following code AFTER the "RUN SUPER." statement:
ASSIGN
cNewWhere = "CustNum EQ " + STRING(ipCustNum).
DYNAMIC-FUNCTION('setQueryWhere':U IN h_dorder, INPUT cNewWhere).
DYNAMIC-FUNCTION('openQuery':U IN h_dorder).
9. Save the SmartDialog again to preserve the code changes.
10. Create a new SmartWindow.
11. Drop a FILL-IN and a Button on the SmartWindow.
12. Create a CHOOSE trigger for the Button with the following code:
DO:
RUN gdialog.w(INPUT INTEGER(FILL-IN-1:SCREEN-VALUE)).
END.
13. Save the window as wwin.w.
14. Run the window wwin.w.
15. Type the number 6 in the fill-in and click the button.
16. Observe that the browse in the SmartDialog displays the orders of the customer whose custnum is 6.