Dynamic temp-table array field labels

bob_hicks

New Member
Is there a way to dynamically access the labels of a temp-table field defined as an array.

Example:

DEFINE TEMP-TABLE tt FIELD key1 AS CHARACTER
FIELD preco-matrix AS DECIMAL EXTENT 3
LABEL "Label1","Label2","Label3"
INDEX tt1 IS UNIQUE PRIMARY key1.

---------------

hField = handle-of-tt-Buffer:BUFFER-FIELD(2).
DO i = 1 TO hField:EXTENT:
PUT UNFORMATTED "~"" hField:LABEL(i) "~"".
END.

This obviously doesn't work, but I can't find a documented way to do it.
 
Unfortunately this is not possible at this current time (unless someone can prove me wrong). One way to workaround it is to perform something like the following (call it a hack):



def var hfield as handle no-undo.
def var handle-of-tt-buffer as handle no-undo.

DEFINE TEMP-TABLE tt NO-UNDO RCODE-INFORMATION
FIELD key1 AS CHARACTER LABEL "Not Key1"
FIELD preco-matrix AS DECIMAL EXTENT 3
LABEL "Label1","Label2","Label3"
INDEX tt1 IS UNIQUE PRIMARY key1.

DEFINE VARIABLE decMatrix LIKE TT.preco-matrix NO-UNDO.
DEF FRAME a decMatrix.

handle-of-tt-buffer = TEMP-TABLE TT:DEFAULT-BUFFER-HANDLE.
hField = handle-of-tt-Buffer:BUFFER-FIELD(2).
message decMatrix[1]:LABEL SKIP decMatrix[2]:LABEL SKIP decMatrix[3]:LABEL
view-as alert-box.
 
Back
Top