Progress
Programming
Handbook


The Buffer-field Object

The buffer-field object represents a field of a buffer. You do not create buffer-field objects. Progress creates them automatically when you reference any field of a buffer object.

Using buffer-field objects lets you examine and modify the fields of a buffer and examine the schema properties of the fields.

When your code accesses buffer-fields, Progress checks security permissions at run time.

You can use HANDLE variables to retrieve the handle of a buffer-field object, as the following code fragments demonstrate:

DEFINE VARIABLE my-buffer-handle as HANDLE.
DEFINE VARIABLE my-buffer-field-handle as HANDLE. 
... 
my-buffer-handle = BUFFER custx:HANDLE.
my-buffer-field-handle = my-buffer-handle:BUFFER-FIELD(3). 

DEFINE VARIABLE my-buffer-field-handle as HANDLE. 
... 
my-buffer-field-handle = BUFFER customer:BUFFER-FIELD("cust-num"). 

The following program example demonstrates using buffer–field objects and their BUFFER–VALUE, NAME and EXTENT attributes. Note that buffer–field objects can be used without using query or buffer objects:

p-qryob2.p
/* p-qryob2.p - demonstrates buffer and buffer-field objects */

DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE arrayi AS INTEGER.
DEFINE VARIABLE bh AS WIDGET-HANDLE.
DEFINE VARIABLE fh AS WIDGET-HANDLE EXTENT 100.
DEFINE VARIABLE fhc AS HANDLE.
DEFINE BUFFER custx FOR customer.

FIND FIRST custx.
bh = BUFFER custx:HANDLE.
MESSAGE "Value of City field is: " city:BUFFER-VALUE IN BUFFER custx.
fhc = bh:BUFFER-FIELD("city").
MESSAGE "Name of City field is: " fhc:NAME.
DISPLAY bh:NAME.

REPEAT i = 1 TO bh:NUM-FIELDS TRANSACTION:
    fh[i] = bh:BUFFER-FIELD(i).
    IF i = 5 THEN fh[i]:BUFFER-VALUE = "new addr2".
    DISPLAY fh[i]:NAME fh[i]:EXTENT.
    arrayi = 0.
    IF fh[i]:EXTENT > 0 THEN arrayi = 2.
    DISPLAY STRING(fh[i]:BUFFER-VALUE(arrayi)) FORMAT "x(20)".
END. 

Notes on Dynamic Buffer–Fields

Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095