Try OpenEdge Now
skip to main content
ProDataSets
ProDataSet Attributes and Methods : Accessing a member buffer of a ProDataSet
 

Accessing a member buffer of a ProDataSet

Temp-tables in a ProDataSet are normally accessed through their buffers. This is largely because, while a temp-table can possibly be a part of more than one ProDataSet, a buffer must be specifically associated with a single ProDataSet. The ProDataSet accesses its member temp-tables through the buffers for them. In some cases, as explained here, you can use either a temp-table handle or its buffer handle to access the table, but in general all access is through the buffer. This is important to keep in mind, especially because each static temp-table has by default a buffer of the same name, so the distinction can be confusing. Always remember that TEMP-TABLE ttOrder:HANDLE and BUFFER ttOrder:HANDLE are two different handles that point to different, though related, objects. This section explains the ProDataSet methods and attributes that give you access to the buffers of a ProDataSet, and the buffer attributes and methods for those buffers.
In order to access the member buffers in a ProDataSet, you use the GET-BUFFER-HANDLE method, which accepts either a numeric index or a buffer name, as shown in the following syntax:

Syntax

[handle-var = ] dataset-handle:GET-BUFFER-HANDLE
  ( buffer-index-expression | buffer-name-expression )
In this method:
*buffer-index-expression is the one-based index of the member-buffer in the ProDataSet.
*buffer-name-expression is a character expression that evaluates to the name of a buffer in the ProDataSet.
GET-BUFFER-HANDLE returns the buffer handle of the member buffer, or the Unknown value (?) if the buffer cannot be found.
To find out how many temp-tables there are in a ProDataSet, you use the NUM-BUFFERS attribute, as shown in the following syntax:

Syntax

[ integer-var ] = dataset-handle:NUM-BUFFERS
Of course, if the ProDataSet definition is local to the procedure seeking the buffer handle, you can simply get the handle directly if you know its name without going through the ProDataSet, as shown in the following syntax:

Syntax

hBuffer = BUFFER MyBuffer:HANDLE.
For example, the buffer-name-expression form is useful if you have only the handle to the ProDataSet available and need to locate one of its buffers by name to act on it, to set a callback procedure, or to attach a Data-Source.
The buffer handle provides the same access to the data in the temp-table as any other usage of a buffer handle.
The member buffers of a ProDataSet point back to the ProDataSet handle using the DATASET attribute, as shown in the following syntax:

Syntax

dataset-handle = buffer-handle:DATASET.
This returns the ProDataSet object handle of a member buffer object.