Release 10.1A: OpenEdge Development:
ProDataSets

> ## Returning the partial ProDataSet to the client

> When the user tabs out of the last of the filter fields, you want to pass the selection to `fetchOrders` and get the ProDataSet with selected `Order`s back.

> | To update your code:

> 1. In the procedure `PickOrder.w`, define this trigger block `ON LEAVE OF cSalesRep`:

>     DO:
>        DEFINE VARIABLE cSelection AS CHARACTER  NO-UNDO.
>        ASSIGN iCustNum daOrderDate cSalesRep.
>        IF iCustNum NE 0 THEN
>           cSelection = "CustNum = " + STRING(iCustNum).
>        IF daOrderDate NE ? THEN
>           cSelection = cSelection + (IF cSelection NE "" THEN " AND " ELSE "") +
>           "OrderDate = " + QUOTER(daOrderDate).
>        IF cSalesRep NE "" THEN
>           cSelection = cSelection + (IF cSelection NE "" THEN " AND " ELSE "") +
>           "SalesRep = " + QUOTER(cSalesRep).
>        RUN fetchOrders IN hOrderProc (INPUT cSelection,
>                                       OUTPUT DATASET dsOrder).
>        BtnSave:SENSITIVE = FALSE.
>        OPEN QUERY OrderBrowse FOR EACH ttOrder.
>        DATASET dsOrder:GET-BUFFER-HANDLE(1):SYNCHRONIZE().
>      END.

> The code first constructs a where-clause using whichever of the filter fields were filled in, and passes this to `fetchOrders`. It gets the ProDataSet back as an `OUTPUT` parameter. Since the ProDataSet is not passed by reference, any data that comes back replaces whatever might have been in the local ProDataSet before, so there’s no need to empty the ProDataSet in advance. If you wanted to have the new set of `Order`s appended to the ones already there, then you could use the `APPEND` option on the parameter to do this.

> 2. Try running this much of the `PickOrder.w` procedure. Enter some selection criteria for `Order`s and tab through the `SalesRep` field.

> Here, we retrieve all the `Order`s for `Customer 1` and `SalesRep “HXM”`:

> You see that no `OrderLine` or `Item` information came back, because those tables were set to `NO-FILL`

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