Browse - best way to show total lines

Stefan

Well-Known Member
10.2B / 11.0 OpenEdge GUI.

Our report engine is currently defining all totalizable decimal temp-table fields as characters and left padding with spaces to right-align them. This is done with one goal - to be able to show total lines above and below totals. This has one major drawback and that is that resizing a column results in the amounts simply being truncated.

On another investigation into keeping the decimal fields in their native data type I came up with the following trick to allow lines to be shown in a decimal cell:

Code:
DEFINE TEMP-TABLE tt
   FIELD irowtype AS INTEGER
   FIELD amount   AS DECIMAL
   FIELD sometext AS CHARACTER
   .


SYSTEM-DIALOG FONT 7.


DEF VAR ii AS INT.


DO ii = 32 TO 40:
   CREATE tt. ASSIGN tt.amount = ii * 1.01 tt.sometext = CHR(ii).
END.
CREATE tt. tt.irowtype = 1.
CREATE tt. tt.amount = 125.
CREATE tt. tt.irowtype = 2.


DEFINE QUERY qq FOR tt.


DEFINE BROWSE br QUERY qq
   DISPLAY tt.amount tt.sometext


   WITH SIZE 40 BY 25.


DEFINE FRAME fr 
   br
   WITH SIZE 40 BY 25.


DEF VAR hw AS HANDLE EXTENT 2.


hw[1] = BROWSE br:FIRST-COLUMN.
hw[2] = hw[1]:NEXT-COLUMN.


ON ROW-DISPLAY OF BROWSE br DO:


   IF tt.irowtype = 1 THEN 
      ASSIGN
         hw[1]:FONT = 7
      hw[1]:FORMAT = ">~~~~~~~~~~~~~~~~"
      .
   IF tt.irowtype = 2 THEN 
      ASSIGN
         hw[1]:font = 7
         hw[1]:FORMAT = ">=============="
      .
   hw[2]:FONT = 7.


END.
VIEW FRAME fr. 


ENABLE br WITH FRAME fr.




OPEN QUERY qq FOR EACH tt.




WAIT-FOR CLOSE OF THIS-PROCEDURE.

Unfortunately the hyphen (-) cannot be used since that is interpreted as being a part of the number format and can only be used once in the format. The tilde (~) nearly gets the job done but ideally I would like real lines.

I think some kind of standard line draw font could be used, but am not able to quickly find one.

So:

  1. are there other approaches? (possibly a .Net grid could get the job done better, we're sniffing at them but have not got any of these in our architecture at the moment)
  2. any font suggestions?

Thanks!
 

SergioC

Member
Hi Stefan, this will serve??

Code:
ON ROW-DISPLAY OF BROWSE br DO:




   IF tt.irowtype = 1 THEN 
      ASSIGN
         hw[1]:FONT = 7 /* font courier new */
      hw[1]:FORMAT = ">" + FILL(CHR(175),12).
      .
   IF tt.irowtype = 2 THEN 
      ASSIGN
         hw[1]:font = 7
         hw[1]:FORMAT = ">=============="
      .
   hw[2]:FONT = 7.




END.

Regards.
 

Stefan

Well-Known Member
Hi Stefan, this will serve??

Code:
      hw[1]:FORMAT = ">" + FILL(CHR(175),12).

Regards.

Thanks for the suggestion! I had actually already tried this character (guess what the ii loop max value used to be ;-)) but it is positioned too high in a cell. It also makes the double line below the total look cheap (this can be partly solved by making the font of the double line bold resulting in the = nearly forming a line).
 
Top