Answered Dynamic change of column-label in a browse

ezequiel

Member
Hello, I have a browse in a smartwindow. The browse is a freeform query.

I need to change the column-label of several fieldas, but apparently the DISPLAY trigger doesn't accept variables or expressions, just constants.

Is there a way to dynamically change the column-label?

We use Progress 9.1, Windows 2003 server, Windows 7 workstations.
 

Stefan

Active Member
Not sure what a display trigger has to do with a column label, or a browse at all for that matter, unless you mean the ROW-DISPLAY trigger. But that only effects the rows themselves.

Code:
DEFINE TEMP-TABLE tt
  FIELD cust AS INT FORMAT ">>>>>9"
  FIELD custname AS CHAR FORMAT "x(60)"
  .
 
CREATE tt.
ASSIGN tt.cust = 1 tt.custname = "me".
 
DEFINE QUERY q FOR tt.
 
DEFINE BROWSE br QUERY q
  DISPLAY
      tt.cust
      tt.custname
  WITH SIZE 80 BY 20    EXPANDABLE.
 
DEFINE FRAME fr
  br
  WITH SIZE 80 BY 20.
 
VIEW FRAME fr.
 
OPEN QUERY q FOR EACH tt.
 
DEF VAR hb AS HANDLE.
 
hb = BROWSE br:FIRST-COLUMN.
hb:LABEL = "#".
hb = hb:NEXT-COLUMN.
hb:LABEL = "name".
 
WAIT-FOR CLOSE OF FRAME fr.
 

ezequiel

Member
I meant the DISPLAY trigger of the browse.

For each field, there is a code line :
Code:
temptable.fieldname COLUMN-LABEL "What I need to set" FORMAT "->>,>>>,>>9":U WIDTH 11.2 COLUMN-BGCOLOR 10
I was trying to set the label there, with an expression, but doesn´t work.


With your code example, I need to define a handle for each one of the fields I want to set.

Than can be done, I'll give it a try, thank you very much.
 

Stefan

Active Member
A 'dynamic' browse is often paired with a temp-table, comma separated character variable or handle with an extent containing the additional properties you want to manage.

In the row-display trigger, these are essential if you want to do stuff with the cells, since you are not allowed to query the browse in the row-display trigger itself.

An alternative to your static temp-table definition is a dynamic temp-table in which you can also set the label dynamically, switching to a dynamic temp-table however will require a bit more effort on your part since all parts (query and browse) then also need to be dynamic.

And when going dynamic, really get on a later version.

Code:
hb:BUFFER-FIELD("myfield"):BUFFER-VALUE
Gets boring really quickly compared to the shortcut notation available as of 10.x

Code:
hb::myfield
 
Top