The one thing you cannot set within the CREATE BROWSE statement is the list of columns to display. There are three methods on the browse handle that set the column list after the browse has been created: ADD-COLUMNS-FROM, ADD-LIKE-COLUMNS, and ADD-CALC-COLUMN.

ADD-COLUMNS-FROM method

If you want all or most of the columns from the query’s buffer to be displayed in the browse, use the ADD-COLUMNS-FROM method:

browse-handle:ADD-COLUMNS-FROM ( buffer-name [ , except-list ] ).

If you specify a comma-separated except-list expression, the columns in the list are not included in the browse. All other columns from the buffer-name are included. If the browse’s query uses more than one buffer, you can invoke ADD-COLUMNS-FROM more than once on different buffers used by the query.

If you want to display data in a column using a combo-box or toggle-box widget, specify the widget type in the buffer-field’s VIEW-AS attribute before calling this method.

ADD-LIKE-COLUMN method

If you want to add columns individually, you can use the ADD-LIKE-COLUMN method:

browse-handle:ADD-LIKE-COLUMN( field-name-expr | buffer-field-handle
  [ , pos [ , widget-type ] ] )

This method adds one column at a time to a browse, based on a field name string expression or field handle in a buffer. You can add any number of columns to a browse by making successive calls to this method.

Here are descriptions of the remaining ADD-LIKE-COLUMN options:

  • pos — The integer position of the new column within the browse display list. If you do not specify pos, the column goes at the end of any columns already defined.
  • widget-type — A character expression specifying the widget type to use in displaying data in the column. If you do not specify widget-type, the column is created based on the widget type specified in the buffer-field’s VIEW-AS attribute.

ADD-CALC-COLUMN method

The ADD-CALC-COLUMN method creates a single column based on a list of specified properties rather than deriving it from a specific field in a buffer. This is typically used as a placeholder column for a calculated value:

[ column-handle = ] buffer-handle:ADD-CALC-COLUMN
  (datatype-exp , format-exp , initial-value-exp , label-exp
  [ , pos [ , widget-type ] ] )

Here are descriptions of the ADD-CALC-COLUMN options:

  • column-handle — The handle of the column object returned from the method. You might want to capture this value to associate the column with a ROW-DISPLAY trigger that populates it.
  • datatype-exp — A literal string or character expression evaluating to the data type for the column.
  • format-exp — A string or character expression evaluating to the format for the column.
  • initial-value-exp — A string or expression evaluating to the initial value for the column.
  • label-exp — A string or expression evaluating to the column label for the column.
  • pos — The integer position of the new column within the browse display list. If you do not specify pos, the column goes at the end of any columns already defined.
  • widget-type — A character expression specifying the widget type to use in displaying data in the column.