Try OpenEdge Now
skip to main content
ProDataSets
Data Access and Business Entity Objects : Data Access object : Elements of a Data Access object : FILL event procedures
 
FILL event procedures
If you need special logic to supplement or to fully control the FILL process, the procedures that implement that logic also go into the Data Access object. They can be attached to any ProDataSet instance passed in to the procedure using the SET-CALLBACK-PROCEDURE method. They belong there because they have full knowledge of the specifics of the sources of data, whether they are standard OpenEdge Data-Sources or not, and how the data is mapped to the internal representation used by the rest of the application.
For example, OrderSource.p has these FILL event procedures:
PROCEDURE postOlineFill:
  DEFINE INPUT PARAMETER DATASET FOR dsOrder.

  DEFINE VARIABLE dTotal AS DECIMAL NO-UNDO.

  /* Here as well "ttOline" uses the local definition for compilation but
     points to the ttOline table in the input parameter at run time. */
  FOR EACH ttOline WHERE ttOline.OrderNum = ttOrder.OrderNum:
    dTotal = dTotal + ttOline.ExtendedPrice.
  END.
  ttOrder.OrderTotal = dTotal.
END PROCEDURE. /* postOlineFill */

PROCEDURE postItemRowFill:
  DEFINE INPUT PARAMETER DATASET FOR dsOrder.

  DEFINE VARIABLE cItemTypes AS CHARACTER NO-UNDO
    INITIAL "BASEBALL,CROQUET,FISHING,FOOTBALL,GOLF,SKI,SWIM,TENNIS".
  DEFINE VARIABLE cType AS CHARACTER NO-UNDO.
  DEFINE VARIABLE iType AS INTEGER NO-UNDO.
  DEFINE VARIABLE iTypeNum AS INTEGER NO-UNDO.

  DO iType = 1 TO NUM-ENTRIES(cItemTypes):
    cType = ENTRY(iType, cItemTypes).
    IF INDEX(ttItem.ItemName, cType) NE 0 THEN
      ttItem.ItemName = REPLACE(ttItem.ItemName, cType, cType).
  END.
END PROCEDURE. /* postItemRowFill */
Procedure postOlineFill calculates the Order total, and procedure postItemRowFill reformats the Item Name for each Item.