Try OpenEdge Now
skip to main content
ProDataSets
Updating Data with ProDataSets : Tracking changes in the temp-tables of a ProDataSet : Locating rows in the before- and after-tables
 

Locating rows in the before- and after-tables

There is a pair of complementary attributes for the before- and after-table buffers that point to the record in one table that corresponds to the record in the other table:
*after-buffer-hdl :BEFORE-ROWID returns the ROWID of the record in the before-table that is the before-image for the record in the after-table held in the buffer handle. This attribute is set to the Unknown value (?) for records that have not been changed.
*before-buffer-hdl :AFTER-ROWID returns the ROWID of the record in the after-table that is the current version of the added or changed record in the before-table held in the buffer handle. Deleted records have an AFTER-ROWID of the Unknown value (?).
These attributes allow you, for example, to execute a static FIND statement with a where-clause such as WHERE ROWID(ttBeforeTable) = ttAfterBuffer:BEFORE-ROWID, or a dynamic FIND-BY-ROWID method, to retrieve the buffer handle for the corresponding record in the other table, to do comparisons of field values.
The ROW-STATE, AFTER-ROWID, and BEFORE-ROWID attributes are all read-only.
There are also attributes to point back and forth between the temp-tables themselves:
*after-table-handle :BEFORE-TABLE returns the handle of the before-table for this after-table.
*before-table-handle :AFTER-TABLE returns the handle of the after-table for this before-table.
These attributes are also read-only.
In addition, you can point directly from the buffer for one table to the buffer for the other using these attributes on a buffer handle:
*after-buffer-handle :BEFORE-BUFFER returns the handle of the default buffer for the before-table that is associated with the after-table for after-buffer-handle. Note that after-buffer-handle can be any buffer for the after-table, while the buffer handle you get back as the attribute value is always the default buffer for the other table.
*before-buffer-handle :AFTER-BUFFER similarly returns the handle of the default buffer for the after-table, relative to any buffer for the before-table.
When you pass a ProDataSet as a parameter remotely, any before-tables associated with its temp-tables are automatically and transparently marshaled along with it. If passed locally by value, then the before-tables are copied along with the after-tables. If passed locally BY-REFERENCE, then all references to the before-table are available to the procedure receiving the ProDataSet.