An AGGREGATE field defines a screen-record field to display summary information for a TABLE column.
AGGREGATE item-tag = field-name [ , attribute-list ] ;
An AGGREGATE field defines a form field that is used to display a summary cell for a given column of a TABLE container. The aggregate fields are displayed after the last data line of the table. Such fields are typically used to show computed values for the corresponding column which appears above the aggregate cell.
An aggregate field can be based on a database column defined in a schema file, or as FORMONLY field.
The AGGREGATETYPE attribute defines how the value of the field will be computed. For example, the SUM keyword (the default) can be used to instruct the runtime system to automatically compute the total of the associated column. By using the PROGRAM keyword, you indicate that the value of the aggregate field will be computed and displayed by program code. A simple DISPLAY BY NAME or DISPLAY TO can be used to show the summary value.
The value displayed in the AGGREGATE field follows the FORMAT attribute of the corresponding column, if defined. The FORMAT attribute is applied for automatically computed values, as well as for values displayed by user code with DISPLAYBY NAME or DISPLAY TO.
The label of an aggregate field can be specified with the AGGREGATETEXT attribute. The text defined with this attribute will be displayed on the left of the aggregate value (in the aggregate cell), except if there is no room to display the label (for example if the aggregate value is too large or if the column values are aligned to the left). An aggregate label can be a localized string with the %"..." string syntax. You can also specify an AGGREGATETEXT attribute at the TABLE level, to get a global label for the summary line. If no text is defined for an aggregate field, the global aggregate text will appear on the left in the summary line.
Table aggregate decoration can be modified with a presentation style. Use the summaryLine pseudo-selector to change the font type and color, as well as the background of the summary line. Use the summaryLineAlwaysAtBottom table style attribute to force the summary line to stay on the bottom of the table.
TABLE { [c1 |c2 |c3 |c4 |c5 ] [c1 |c2 |c3 |c4 |c5 ] [c1 |c2 |c3 |c4 |c5 ] [c1 |c2 |c3 |c4 |c5 ] [cnt ] [tot_c4 |tot_c5 ] } END
SCHEMA stores LAYOUT( TEXT = "Orders" ) GRID { <T t1 > Num Date Order total [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] [c1 |c2 |c3 ] [total ] } END END TABLES orders END ATTRIBUTES TABLE t1: table1; EDIT c1 = orders.o_num; EDIT c2 = orders.o_date; EDIT c3 = orders.o_tot; AGGREGATE total = FORMONLY.o_total, AGGREGATETEXT = "Total:", AGGREGATETYPE = SUM; END INSTRUCTIONS SCREEN RECORD sr(orders.*); END