Kbase P121906: Why can a buffer only be a child of one parent buffer in Data-Relations for a ProDataSet?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  08/05/2009 |
|
Status: Verified
GOAL:
Why can a buffer only be a child of one parent buffer in Data-Relations for a ProDataSet?
GOAL:
How to have two relations between the same two dataset buffers?
FACT(s) (Environment):
OpenEdge 10.1B
All Supported Operating Systems
FIX:
There are several methods for buffers, datasets, and data-relations that require a buffer to have only one parent--GET-CHANGES method, GET-PARENT method, PARENT-BUFFER attribute, etc. Most importantly it is how a ProDataSet is filled that restricts a buffer to only one parent.
First, the FILL method finds all the top-level buffers in the ProDataSet, which are those that are not children in any active Data-Relation. This means that a child of a relation that has been deactivated is treated like a top-level buffer for a FILL of a ProDataSet. In this way you assure that a FILL on a ProDataSet touches every buffer in the ProDataSet.
Next, the FILL method then starts a nested filling operation starting at each top-level buffer, paying attention to the Data-Relations for which the top buffer is the parent, and proceeds down through parent-child relationships recursively. If the buffer is a parent to any other buffer and the relation is active, then the method gets each record in the parent, goes to each child of that parent and fills the child temp-table with those records related to the current parent, and cascades as it fills in further children down the hierarchy before moving on to the next parent record.
If a buffer was a child to more than one parent buffer, the FILL method would get confused and fill the child level multiple times.
The example below shows how to have two relations between the same two dataset buffers but only have 1 active at a time. It specifies NOT-ACTIVE as an option at the end of the DATA-RELATION phrase in DEFINE DATASET to initially set the relation inactive. This NOT-ACTIVE function is only available in OpenEdge 10.1B and later releases.
/* Define Temp-Tables. */
define temp-table ttcust like customer.
define temp-table ttorder like order.
define temp-table ttorderline like orderline.
define temp-table ttitem like item.
/* Define ProDataSet and set Data-Relations. */
define dataset ds for ttcust, ttorder, ttorderline, ttitem
data-relation r1 for ttcust,ttorder relation-fields(custnum, custnum)
data-relation r2 for ttorder,ttorderline relation-fields(ordernum,ordernum)
data-relation r3 for ttorderline,ttitem relation-fields(itemnum,itemnum)
data-relation r4 for ttitem,ttorderline relation-fields(itemnum,itemnum)
not-active
data-relation r5 for ttorderline,ttorder relation-fields(ordernum,ordernum)
not-active
data-relation r6 for ttorder,ttcust relation-fields(custnum, custnum)
not-active.
/* Set certain Data-Relations as active or inactive. */
dataset ds:get-relation("r1"):active = false.
dataset ds:get-relation("r2"):active = false.
dataset ds:get-relation("r3"):active = false.
dataset ds:get-relation("r4"):active = true.
dataset ds:get-relation("r5"):active = true.
dataset ds:get-relation("r6"):active = true.