Try OpenEdge Now
skip to main content
ProDataSets
Introducing the OpenEdge DataSet : Populating a ProDataSet : Defining a query on a child table
 

Defining a query on a child table

As the FILL method has been described so far, the AVM fills child tables based on the Data-Relation between the child and its parent. Normally, you define a query for each top-level parent table. But you can also define a query for a child table of a Data-Relation. In this case, the AVM ignores the fields in the Data-Relation and executes the query on the child table. Depending on the query selection criteria, this can result in records in the child table that are not related to a parent. No error results in this case. Such records simply will not be found by the default traversal of parent and child that uses the Data-Relation and must be located in some other way with code in the procedure using the ProDataSet.
In order to facilitate defining a query for a child table that references its parent (but which presumably does additional selection beyond what the AVM would do by default), the query syntax for these queries within ProDataSets is extended to permit the query definition to reference a field in the parent table directly. The child query needs to be prepared only once, and the AVM substitutes the proper value for the current parent record each time the FILL proceeds from parent to child.