Consultor Eletrônico



Kbase P112854: 4GL: How to get and set the buffer-field object handle BUFFER-VALUE attribute?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/25/2006
Status: Unverified

GOAL:

How to access and assign the buffer-field object handle BUFFER-VALUE attribute?

GOAL:

How to access the buffer-field object handle BUFFER-VALUE attribute?

FIX:

The BUFFER-VALUE attribute gets or sets the value of a buffer-field object handle. The STRING-VALUE attribute gets the character representation of the value of a buffer-field object handle. The following code demonstrates how to get and set the BUFFER-VALUE attribute and how to get the STRING-VALUE attribute of the the City and CreditLimit field objects of the Customer table buffer. Notice that setting the BUFFER-VALUE attribute of a field needs to be done within a transaction:
DEFINE VARIABLE hRecordBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hFieldBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE iFieldCounter AS INTEGER NO-UNDO.
ASSIGN
hRecordBufferHandle = BUFFER customer:HANDLE.
FOR EACH Customer WHERE custnum < 100 :
DO iFieldCounter = 1 TO hRecordBufferHandle:NUM-FIELDS:
hFieldBufferHandle = hRecordBufferHandle:BUFFER-FIELD(iFieldCounter).
IF hFieldBufferHandle:NAME = "City" AND hFieldBufferHandle:STRING-VALUE = "Boston" THEN
DO TRANSACTION:
hFieldBufferHandle:BUFFER-VALUE = "BOSTON".
END.
IF hFieldBufferHandle:NAME = "CreditLimit" AND hFieldBufferHandle:BUFFER-VALUE = 1000 THEN
DO TRANSACTION:
hFieldBufferHandle:BUFFER-VALUE = 2000.
END.
END.
END.