AggregateOperand.Max(CriteriaOperator) Method
Creates a new AggregateOperand which returns the maximum of the values calculated by the given aggregate expression. This expression is evaluated against elements of the AggregateOperand.CollectionProperty that match the specified AggregateOperand.Condition.
Namespace: DevExpress.Data.Filtering
Assembly: DevExpress.Data.v24.2.dll
NuGet Package: DevExpress.Data
#Declaration
public AggregateOperand Max(
CriteriaOperator aggregatedExpression
)
#Parameters
Name | Type | Description |
---|---|---|
aggregated |
Criteria |
A Criteria |
#Returns
Type | Description |
---|---|
Aggregate |
An Aggregate |
#Example
#Example 1
Get the max value from a whole collection.
Expression:
CriteriaOperator.FromLambda<Order, int>(o => o.OrderItems.Max(oi => oi.ItemPrice));
Input:
Order | Order | Item |
---|---|---|
Order0 | ||
Order | 10 | |
Order | 20 |
The result: 20
#Example 2
Get the max value from a filtered collection.
Expression:
CriteriaOperator.FromLambda<Order, int>(o => o.OrderItems.Where(oi => oi.IsAvailable == true).Max(oi => oi.ItemPrice)); ;
Input:
Order | Order | Item | Is |
---|---|---|---|
Order0 | |||
Order | 10 | False | |
Order | 20 | True | |
Order | 30 | True | |
Order | 40 | False |
The result: 30