Datasnap.DBClient.TAggregate.Expression
Delphi
property Expression: string read FExpression write SetExpression;
C++
__property System::UnicodeString Expression = {read=FExpression, write=SetExpression};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | published | Datasnap.DBClient.pas Datasnap.DBClient.hpp |
Datasnap.DBClient | TAggregate |
Description
Specifies the formula used to calculate the aggregate value.
Set Expression to indicate how aggregate values should be calculated. Expression is an expression that includes one or more of the summary operators in the following table:
Operator | Use |
---|---|
Sum |
Totals the values for a numeric field or expression |
Avg |
Computes the average value for a numeric or date-time field or expression |
Count |
Specifies the number of non-blank values for a field or expression |
Min |
Indicates the minimum value for a string, numeric, or date-time field or expression |
Max |
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 |
Min(Sum(Field1)) |
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.