Try OpenEdge Now
skip to main content
ProDataSets
Advanced Events and Attributes : Successive loading of ProDataSet data : Filtering the top-level query based on the user selection
 

Filtering the top-level query based on the user selection

You will recall from earlier examples that the ProDataSet BEFORE-FILL event procedure, called preDataSetFill, prepares the top-level query for Orders to select the one OrderNum passed in as an input parameter. Now you want to use the where-clause stored in the variable cSelection instead.
Modify preDataSetFill accordingly, as shown:
PROCEDURE preDataSetFill:
  DEFINE INPUT PARAMETER DATASET FOR dsOrder.

  QUERY qOrder:QUERY-PREPARE("FOR EACH Order WHERE " + cSelection +
    ", FIRST Customer OF Order, FIRST SalesRep OF Order").
END PROCEDURE. /* preDataSetFill */
Now the fill will load not just one Order, but typically a whole set of Orders into the top-level table.