Try OpenEdge Now
skip to main content
ProDataSets
Dynamic ProDataSet Basics : Specifying member buffers
 

Specifying member buffers

Every member of a ProDataSet is identified by a buffer for the temp-table holding that member's data. The same buffer cannot be added to more than one ProDataSet concurrently, although a member table can be a part of more than one ProDataSet, using separate buffers for independent record currency.
You can specify one or more buffers for a dynamic ProDataSet with the SET-BUFFERS method, which has the following syntax:

Syntax

[logical-var = ] dataset-handle:SET-BUFFERS
  ( {buffer-handle-expression | buffer-name-expression }
  [ , {buffer-handle-expression | buffer-name-expression } ] … )
This statement defines all the buffers for the ProDataSet in a single method call, whether there are one or more temp-tables in the ProDataSet.
Alternatively, you can add buffers to a dynamic ProDataSet one at a time, using the ADD-BUFFER method. This is the syntax for the ADD-BUFFER method:

Syntax

[ logical-var = ] dataset-handle:ADD-BUFFER
  ( buffer-handle-expression | buffer-name-expression )
These definitions apply to both the ADD-BUFFER and the SET-BUFFERS methods:
*buffer-handle-expression can be either a temp-table handle or a buffer handle. If it is a temp-table handle, then the temp-table's default-buffer-handle is used as the buffer handle.
*buffer-name-expression is the name of a static buffer for a temp-table scoped to the procedure that contains the statement.
Both ADD-BUFFER and SET-BUFFERS return an optional logical status, which is true if the method was successful and false if not. Use SET-BUFFERS just once to set the entire buffer list for the ProDataSet. If there were any buffers already added, SET-BUFFERS removes them first. ADD-BUFFER adds a single buffer to those already there.
If you want to reset your ProDataSet to have no buffers, you can use the following syntax:

Syntax

dataset-handle:CLEAR()
This removes all elements from the ProDataSet definition, including buffers, relations, and so on. It restores the state of the handle to exactly what it was after the CREATE DATASET statement.
As noted, by default, dynamic buffers that are added to a ProDataSet are deleted when the ProDataSet is deleted, unless you set the buffer's AUTO-DELETE attribute to false.