Use buffer-field objects
- Last Updated: October 15, 2024
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
There is a buffer-field object for each field in a buffer, whether the buffer is static or dynamic. You can access a field within a buffer through its handle, using one of two types of arguments to the buffer-field method, either its ordinal position within the buffer or its field name.
Buffer fields have all the same attributes that static field-level objects have. You’re already
familiar with these attributes from static syntax, including
COLUMN-LABEL, DATA-TYPE, DBNAME,
DECIMALS, EXTENT, FORMAT,
HANDLE, HELP, INITIAL,
LABEL, MANDATORY, NAME,
TABLE, and WIDTH-CHARS. Buffer field objects also
have several useful attributes distinctive to the object and accessible only through its
handle. This topic summarizes those objects.
You cannot create or delete a buffer field independent of its buffer. Buffer field objects are created when a buffer is created. They are deleted along with the buffer, if it is dynamic. In the case of static buffers, the buffer field is really just a handle through which you can access useful attributes.
BUFFER-HANDLE attribute
BUFFER-HANDLE attribute is the handle of the buffer the field belongs to. So, theBUFFER-FIELD attribute points from the buffer
to one of its fields, and the BUFFER-HANDLE attribute points from any
field back to its buffer.BUFFER-NAME attribute
BUFFER-NAME is a CHARACTER attribute which holds the name of the buffer the field belongs to.
BUFFER-VALUE and STRING-VALUE methods
The BUFFER-VALUE is the value of the field in its native
data type. This method returns a value in whatever the data type of the field is. In
contrast, STRING-VALUE returns a CHARACTER value that holds the field value as it
is formatted for display. It is therefore in the same format as the
SCREEN-VALUE of a displayed field. Note that this is not
necessarily the same as what the expression
STRING(hField:BUFFER-VALUE) would return, because the
STRING-VALUE includes any characters that are part of the field
format, whereas using the STRING function simply changes the value
to a character string without applying any special formatting to it.
POSITION attribute
POSITION is an INTEGER attribute which is the ordinal position of the field within the buffer.
BUFFER-FIELD(n) form to identify the field and the value of the
field’s POSITION attribute. The order using
BUFFER-FIELD(n) is the display order of the fields, which is
determined using the Order # as it is assigned in the Data Dictionary. The
POSITION attribute is assigned internally as fields are created
for a table, and does not change, even though the display Order # can be changed.
Also, the first field position is reserved so that the numbering of the
POSITION begins with 2. For example, this code shows the
POSITION attribute value for each Customer
field:
|
VIEW-AS attribute
VIEW-AS is a CHARACTER attribute which specifies the
widget type to use when displaying a buffer-field as a combo-box or
toggle-box column in a dynamic or static updateable browse. Set this attribute for
the buffer-field before you create the column with the
ADD-LIKE-COLUMN() or ADD-COLUMNS-FROM()
methods.