Progress
Programming
Handbook
Using Calculated Fields
A browse widget can show a calculated result of browse fields as a separate column. This is accomplished by adding the expression to the DEFINE BROWSE statement. All valid browse format phrase options are legal extensions to the expression (for example, a LABEL option). When the browse is opened, the calculated field is displayed for each row.
For updatable browse widgets, however, you need to refresh the calculation if one of the fields in the expression changes. The browse will display the appropriate calculations only when the query refreshes the data. It is more appropriate to programmatically refresh the calculated data when the user finishes editing the affected row. To accomplish this, use a base field as a placeholder for the expression. You then can reference the calculation and refresh the result as needed.
The code example below sets up a calculated field using a base field in the browse widget. The LEAVE trigger on the browse column forces a refresh of the calculated data as soon as the user leaves the browse cell:
NOTE: With calculated fields in the DISPLAY phrase, you cannot use the ENABLE ALL option, unless you use the EXCEPT option to exclude the calculated field, since calculated fields cannot be edited.When you run this example, the following browse appears:
![]()
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |