From RAD Studio API Documentation
Jump to: navigation, search


property Expression: string read FExpression write SetExpression;


__property System::UnicodeString Expression = {read=FExpression, write=SetExpression};


Type Visibility Source Unit Parent
property published
Data.DB TAggregateField


Specifies the formula used to calculate the aggregate value.

Set Expression to indicate how aggregate values should be calculated. Expression contains an expression that includes one or more of the summary operators in the following table:

Operator Use


Totals the values for a numeric field or expression.


Computes the average value for a numeric or date-time field or expression.


Specifies the number of non-blank values for a field or expression. Use count(*) to count the number of records in a dataset or subgroup.


Indicates the minimum value for a string, numeric, or date-time field or expression.


Indicates the maximum value for a string, numeric, or date-time field or expression.

Sum(Qty * Price)

{legal -- summary of an expression on fields }

Max(Field1) - Max(Field2)

{legal -- expression on summaries }

Avg(DiscountRate) * 100

{ legal -- expression of summary and constant }


{ illegal -- nested summaries }

Count(Field1) - Field2

{ illegal -- expression of summary and field }

The summary operators act on field values or on expressions built from field values using the same operators you use to create filters. (You can't nest summary operators, however.) You can create expressions by using operators on summarized values with other summarized values, or on summarized values and constants. However, you can't combine summarized values with field values, because such expressions are ambiguous (there is no indication of which record should supply the field value.) These rules are illustrated in the following expressions:

Note: To specify the set of records summarized by this expression, use the GroupingLevel property.

See Also