Consultor Eletrônico



Kbase P103227: Error (7365) Accessing the BUFFER-VALUE Attribute of a buffer-field object.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/13/2005
Status: Unverified

SYMPTOM(s):

Error (7365) Accessing the BUFFER-VALUE Attribute of a buffer-field object.

<fieldname> BUFFER-VALUE argument must be valid array index, less than or equal to field extent <number>. (7365)

Country BUFFER-VALUE argument must be valid array index, less than or equal to field extent 0.

MonthQuota BUFFER-VALUE argument must be valid array index, less than or equal to field extent 12.

Running code similar to:
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
DEFINE VARIABLE hQueryCustomer AS HANDLE NO-UNDO.
DEFINE VARIABLE hBufferCustomer AS HANDLE NO-UNDO.
DEFINE VARIABLE hFieldCountry AS HANDLE NO-UNDO.
CREATE BUFFER hBufferCustomer FOR TABLE "customer".
CREATE QUERY hQueryCustomer.
hQueryCustomer:SET-BUFFERS(hBufferCustomer).
hQueryCustomer:QUERY-PREPARE("FOR EACH Customer NO-LOCK").
hQueryCustomer:QUERY-OPEN.
hQueryCustomer:GET-FIRST.
ASSIGN
hFieldCountry = hBufferCustomer:BUFFER-FIELD("Country")
/* The next line of code generates the error */
c = hFieldCountry:BUFFER-VALUE(1).

CAUSE:

The error is generated because the code references the non existing BUFFER-VALUE(1). As the field Country is not an array. Its EXTENT Attribute can not exceed 0. The same error may be generated by any reference for a field's BUFFER-VALUE(i) where the index i exceeds the field's EXTENT. For example the statement: c = hFieldMonthQuota:BUFFER-VALUE(13) would also generate the same error when used in conjunction with the SalesRep.MonthQuota buffer-field object since the EXTENT of that field is only 12.

FIX:

Ensure that the integer argument used with BUFFER-VALUE Attribute of a buffer-field object does not exceed its EXTENT. For example:
/* Define variables */
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE hQuerySalesRep AS HANDLE NO-UNDO.
DEFINE VARIABLE hBufferSalesRep AS HANDLE NO-UNDO.
DEFINE VARIABLE hFieldMonthQuota AS HANDLE NO-UNDO.
/* Create Table buffer and query handles */
CREATE BUFFER hBufferSalesRep FOR TABLE "SalesRep".
CREATE QUERY hQuerySalesRep.
/* Set the query buffer, prepare it, open it and get first record */
hQuerySalesRep:SET-BUFFERS(hBufferSalesRep).
hQuerySalesRep:QUERY-PREPARE("FOR EACH SalesRep NO-LOCK").
hQuerySalesRep:QUERY-OPEN.
hQuerySalesRep:GET-FIRST.
/* Get the MonthQuota buffer field object handle */
ASSIGN
hFieldMonthQuota = hBufferSalesRep:BUFFER-FIELD("MonthQuota").
/* Loop through the array ements of the filed and display its values as decimals */
DO i = 1 TO hFieldMonthQuota:EXTENT:
DISPLAY DECIMAL(hFieldMonthQuota:BUFFER-VALUE(i)) FORMAT "9,999.99" WITH FRAME a DOWN.
DOWN WITH FRAME a.
END.