Formatting Fields in TT handle

ryanmckeever

New Member
Hope you are well...

I'm trying to develop a generic browse object

I want to pass it in a TT handle
It'll take this handle and build a browse exactly like it...
This works...

The problem arose when I tried to tidy the browse up.
If you look at the included code....
This will work if you copy it to a procedure editor

When you run this the message shows that the format and the label for the static TT has been ignored...The field name is correct

Does anyone know how to pick up this information?

DEFINE TEMP-TABLE ttTest
FIELD fld1 AS DEC LABEL "test"
FIELD fld2 AS CHAR FORMAT 'x(20)'
FIELD fld3 AS DATE
FIELD fld4 AS INT FORMAT '9'.

DEFINE VARIABLE hTT AS HANDLE NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.

/* this just populates some data to the TT */
DO i = 1 TO 20:
CREATE ttTest.
ASSIGN
fld1 = i
fld2 = "ryan mc keever:" + STRING(i)
fld3 = TODAY - i
fld4 = i.
END.

hTT = TEMP-TABLE ttTest:handle.
RUN pcReadTT (hTT).

PROCEDURE pcReadTT:
DEFINE INPUT PARAMETER iphTT AS HANDLE.
DEFINE VARIABLE hB AS HANDLE NO-UNDO.
DEFINE VARIABLE hQ AS HANDLE NO-UNDO.
DEFINE VARIABLE iInd AS INTEGER NO-UNDO.
DEFINE VARIABLE hCol AS HANDLE NO-UNDO.
DEFINE VARIABLE hField AS HANDLE NO-UNDO.
hB = iphTT:DEFAULT-BUFFER-HANDLE.
CREATE QUERY hQ.
hQ:SET-BUFFERS(hB).
hQ:QUERY-PREPARE("for each " + iphTT:NAME + " Where TRUE ").
hQ:QUERY-OPEN().
/* Loop around the fields of the buffer */
DO iInd = 1 TO hB:NUM-FIELDS:
hField = hB:BUFFER-FIELD(iInd).
/* show what these attributes are set to */
/* I want to build a browser column like this !!!!! */
MESSAGE
hField:NAME
hField:FORMAT
hField:WIDTH-CHARS
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
END.
 
Ryan, had the same problem a while back and it appears for temp-tables it defaults to the standard Progress values - X(8) for character, ->>,>>9.99 for decimal etc - when trying to pick these up. If any help, the only solution I came up with was have an extra temp-table that stores the required labels and formats for each field in the main temp-table and use that instead.
 
Thanks for the reply...

There is a number of things I could do here...
As Osborne suggested
Was considering scanning the contents of the TT to check sensible widths

I do a lot of appServer work so everything is held in TT's it would have been nice to simply allow the user to define their static Temp-Table and then have the browse built from that. Any extra coding might put the users off.

The main reason for this is so that I can offer lots of default 'look and feel' and browse functionality, excel exports, column sorting and the likes without the developer having to do any extra coding.

I've just tested this in OE10.1b and it works there so at least Progress have gotten their act together on this one...

I guess the solution is to migrate!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Back
Top