Try OpenEdge Now
skip to main content
ProDataSets
Advanced Events and Attributes : Successive loading of ProDataSet data : Returning the partial ProDataSet to the client
 

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 Orders back.
To return the partial ProDataSet to the client:
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 (cSelection, OUTPUT DATASET dsOrder).

tnSave: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 is no need to empty the ProDataSet in advance. If you wanted to have the new set of Orders 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 Orders and tab through the SalesRep field.
Here, we retrieve all the Orders for Customer 1 and SalesRep "HXM":
You see that no OrderLine or Item information came back, because those tables were set to NO-FILL.