Try OpenEdge Now
skip to main content
ProDataSets
Introducing the OpenEdge DataSet : Using ProDataSets : ProDataSet relations
 

ProDataSet relations

A single temp-table lets you define any two-dimensional set of data. A business application typically must be able to treat a number of different sets of data as a single object, representing header and detail records, various parent-child relationships, useful lists of codes or other lookup values that are part of the validation logic, and so forth. The fundamental feature of a ProDataSet beyond what you can do with a single temp-table is that it allows you to define these relations as part of the ProDataSet definition. It also uses relations when it loads data into the ProDataSet and also to filter data in a useful way when application code is navigating a ProDataSet after it has been populated.
Part of the ProDataSet definition, whether static or dynamic, is a set of relation objects, called Data-Relations, each of which defines a relationship between a parent buffer and a child buffer in the ProDataSet. These relations name the fields in parent and child that form a primary-foreign key relationship between the buffers. The AVM uses this information when the ProDataSet is populated, or filled, with a set of related records to retrieve child records related to a parent automatically.
The Data-Relation is also used after the ProDataSet has been filled, in what we can term "navigation" mode, when the application, either through a user interface or in business logic, needs to traverse the ProDataSet to display or examine the data, make changes, add records, and so on. In this mode, the AVM uses the Data-Relation to provide an automatically generated dynamic query on each child buffer of a relation that filters the records at that level to include only those related to the currently selected parent. This is helpful when the records in one of the temp-tables are displayed in a browse, or when the application code needs to traverse records related to the current parent.
The ProDataSet supports any number of levels of relation, so that you can represent parent-child-grandchild relationships in a complex business object using a single ProDataSet.
You can deactivate Data-Relations and then later reactivate them. You can do this to populate portions of a ProDataSet at a time. Or you might deactivate a relation because it is more efficient to populate all the records for the child table at once, rather than selecting them individually for each parent record.