Add columns to the browse
- Last Updated: May 8, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
After you create the browse you must add columns to it individually. There are three methods
you can use to do this: ADD-COLUMNS-FROM,
ADD-LIKE-COLUMNS, and ADD-CALC-COLUMN. These are
much like the dynamic temp-table methods: ADD-FIELDS-FROM,
ADD-LIKE-FIELD, and ADD-NEW-FIELD.
ADD-COLUMNS-FROM method
The ADD-COLUMNS-FROM method takes a table name (which can be a database table or a temp-table) and an optional list of fields to omit from the browse:
|
This method returns true if it succeeds and false otherwise.
As with the similar temp-table methods, you can specify the table using its handle or using a character expression that evaluates to its name.
The method creates a column in the browse for every field in the table you pass, except those in the except-list.
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
The ADD-LIKE-COLUMN method adds a single column to the browse whose attributes are taken from a field either in a database table that is connected when the procedure is compiled or in a temp-table that is in scope when the method is encountered:
|
You can pass an optional second argument that specifies the position of the column
within the browse. If you do not specify the position, the column is added to the
end of the column list for the browse. You can also pass an optional third argument
that specifies a widget type to use in displaying data in the column. If you do not
specify a widget type, the column is created based on the widget type specified in
the buffer-field’s VIEW-AS attribute.
This method returns the handle of the browse column created. You might want to save off the browse column handle, or you can access it later through the browse handle.
ADD-CALC-COLUMN method
The ADD-CALC-COLUMN method adds a single column to the browse that is not derived from a field in a database table or temp-table. You can use this method to add a field you use to display a calculated value:
|
This method also returns the handle of the browse column created. You must specify a data type, format, initial value, and label for the column. You can optionally specify an ordinal position within the list of browse columns. If you do not specify the position, each new column is added to the end of the list. You can also optionally specify a widget type to use in displaying data in the column.
VIEW-AS attribute or the respective ADD
method. For more information, see the ABL Reference.