Consultor Eletrônico



Kbase P102922: ADM2: How to filter a SmartBrowser based on a FILL-IN:SCREEN-VALUE representing a field of the child
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/10/2008
Status: Verified

GOAL:

ADM2: How to filter a SmartBrowser based on a FILL-IN:SCREEN-VALUE representing a field of the child table?

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x
Windows

FIX:

The following steps demonstrate how to make a SmartBrowser Object display data from the order and OrderLine tables only if the OrderLine.ItemNum is equal to the number entered by the user into a FILL-IN widget:
1. Start the AppBuilder and connect to the Sports2000 database.
2. Create an SmartDataObject (SDO) selecting the OrderLine and Order tables in that order.
3. Verify that the default SDO query is:
"FOR EACH OrderLine NO-LOCK, EACH Order OF OrderLine NO-LOCK INDEXED-REPOSITION"
4. Select the fields of interest and save the SDO. Make sure to include the OrderLine.ItemNum in the selected fields. Save it as "dOrderOrderline.w"
4. Create a SmartBrowser against the newly created SDO and save it. Save it as "bOrderOrderline.w".
5. Create a new smart window.
6. Drop the SDO; "dOrderOrderline.w"; created above onto the newly created window.
7. Drop the SmartBrowser; "bOrderOrderline.w"; created above onto the newly created window.
8. Accept the default links offered by the wizard.
9. Drop a FILL-IN widget onto the window. Name it "fiItemNumber". Label it Item Number.
10. Define a LEAVE event trigger for the FILL-IN "fiItemNumber" with the following code:
DO:
DEFINE VARIABLE cWhere AS CHARACTER NO-UNDO INITIAL "".
ASSIGN
cWhere = "OrderLine.ItemNum = " + fiItemNumber:SCREEN-VALUE.
DYNAMIC-FUNCTION('setQueryWhere' IN h_dOrderOrderline, INPUT cWhere).
DYNAMIC-FUNCTION('openQuery':U IN h_dOrderOrderline).
END.
11. Save the window.
12. Run it. Observe it initially
13 Enter an Item Number and hit tab or click the mouse over the browse.
14. The LEAVE trigger of the FILL-IN "fiItemNumber" fires causing the browse to display only the rows where OrderLine.ItemNum is equal to the value input by the user.