Table views can display a summary line, to show aggregate values for columns.
To get a summary line in a table, define aggregate field item tags at the bottom of the
TABLE container, with the corresponding AGGREGATE form item
definitions in the ATTRIBUTES section.
Define the type of the aggregate field with the AGGREGATETYPE attribute: The
aggregate value can be automatically computed, or set by program.
To get a global label for the summary line, specify the AGGREGATETEXT attribute at the
TABLE level. This aggregate label will appear on the left in the summary line, if
no aggregate text is defined at the aggregate field level.
Aggregate fields are not rendered when using a FLIPPED table.
The following form definition file defines two aggregate fields for the second and third columns
of the table:
MAIN
DEFINE arr DYNAMIC ARRAY OF RECORD
pkey INT,
name VARCHAR(20),
price DECIMAL(10,2)
END RECORD
DEFINE x INT
FOR x=1 TO 50
LET arr[x].pkey = 100+x
LET arr[x].name = SFMT("item%1",x)
LET arr[x].price = (3.45 * x) + (1.23 * (x MOD 2))
END FOR
OPEN FORM f1 FROM "form"
DISPLAY FORM f1
DISPLAY ARRAY arr TO sr.* ATTRIBUTES(UNBUFFERED)
END MAIN
Visual result of the above sample:Figure: Table with AGGREGATE fields