Retrieve detail for the ProDataSet
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Now you want to get the OrderLines for
a selected Order. You start by creating a trigger
that fires in response to a double-click on an Order in
the browse.
To get the OrderLines for a
selected Order:
-
Define a trigger block
ON MOUSE-SELECT-DBLCLICK of OrderBrowse(this is one of the Portable Mouse Events).When the user selects an
Order, the trigger saves off theOrdernumber for later reference. It must then delete the temp-table row for thatOrder. For example:DO: DEFINE VARIABLE iOrderNum AS INTEGER NO-UNDO. iOrderNum = ttOrder.OrderNum. CLOSE QUERY OrderBrowse. DELETE ttOrder.Why is this? When you pass the request to the support procedure to fill in the detail, it is going to prepare the top-level
Orderquery for that one selectedOrder, set theFILL-MODEback to "APPEND" forOrderLinesandItems, and then do aFILL. ThatFILLwill read theOrderinto the top-level table along with itsOrderLinesand allItems. When this is returned to the client to be appended to the data already in the client's ProDataSet, thatttOrderrow is going to be a duplicate of the row already there, and this will cause an error. Remember, when you use theOUTPUT APPENDparameter form, new data in each temp-table is always appended to the rows already there. There is no ability to use theFILL-MODEto define a different behavior for each temp-table.Therefore, you must delete rows that will result in duplicates in advance, either on the sending side or the receiving side, before the new data is appended. In this case, deleting the existing row has the advantage of returning the latest field values for the
Orderalong with itsOrderLines, giving you what amounts to aREFRESHmode for theOrder. This, in general, is how you accomplish a refresh of data in a ProDataSet, simply by deleting the rows you want to refresh and then requesting them again. -
In case the user has selected an
Orderthat has been selected before, you delete anyOrderLinesfor it so that they are refreshed as well. For example:FOR EACH ttOline WHERE ttOline.OrderNum = iOrderNum: DELETE ttOline. END. -
You run another support procedure in orderSupport.p,
called
fetchOrderDetail, passing in the selectedOrder Numberand a flag telling the procedure whetherItemshave already been returned or not. If theItemsare already on the client they do not have to be refilled and passed from the server. The ProDataSet is received inAPPENDmode so that theOrderandOrderLinesthat come back are added to what is already in the local ProDataSet, as shown:RUN fetchOrderDetail IN hOrderProc (INPUT iOrderNum, INPUT NOT CAN-FIND(FIRST ttItem), OUTPUT DATASET dsOrder APPEND). -
To reset the user interface, you need to open the top-level
query, reposition the query to the selected
Order(which repositions the browse as well), and do aSYNCHRONIZEto reset the dependent queries forOrderLinesandItemsas well. For example:OPEN QUERY OrderBrowse FOR EACH ttOrder. FIND ttOrder WHERE ttOrder.OrderNum = iOrderNum. REPOSITION OrderBrowse TO ROWID ROWID(ttOrder). DATASET dsOrder:GET-BUFFER-HANDLE(1):SYNCHRONIZE(). END. -
In OrderSupport.p, the
fetchOrderDetailprocedure empties the server-side ProDataSet and resets the selection to fill just the one selectedOrder. It resets theFILL-MODEfor thettOlinetable from "NO-FILL" to "APPEND" so thatOrderLinesare read for theOrder, and sets theFILL-MODEfor thettItemtable so thatItemsare filled the first time anOrderis selected, and then left out of the fill after that. For example:PROCEDURE fetchOrderDetail: DEFINE INPUT PARAMETER piOrderNum AS INTEGER NO-UNDO. DEFINE INPUT PARAMETER lFillItems AS LOGICAL NO-UNDO. DEFINE OUTPUT PARAMETER DATASET FOR dsOrder BY-VALUE. hDataSet:EMPTY-DATASET. cSelection = "OrderNum = " + STRING(piOrderNum). hDataSet:GET-BUFFER-HANDLE(2):FILL-MODE = "APPEND". /* ttOline */ hDataSet:GET-BUFFER-HANDLE(3):FILL-MODE = /* ttItem */ IF lFillItems THEN "APPEND" ELSE "NO-FILL". hDataSet:FILL(). END PROCEDURE. -
Make sure that your dsOrder.i include file
has the
REPOSITIONkeyword for theLineItemrelation so that you can see all the items in thettItembrowse. -
Run PickOrder.w, select a set of
Orders using the filter fields, and then double-click on one of theOrders, as shown:
The first time you double-click on an
Order, itsOrderLinesand allItemsare brought over from OrderSupport.p. After that, double-clicking on anotherOrderbrings over itsOrderLineswithout refetching theItems. If you simply select anOrderwithout double-clicking on it, this empties thettOlinebrowse, showing that itsOrderLinesare not yet part of the client's ProDataSet.