AggregateOperand.Count(CriteriaOperator) Method
In This Article
Creates a new AggregateOperand which returns the count of AggregateOperand.CollectionProperty elements that match the AggregateOperand.Condition.
Namespace: DevExpress.Data.Filtering
Assembly: DevExpress.Data.v24.2.dll
NuGet Package: DevExpress.Data
#Declaration
public AggregateOperand Count(
CriteriaOperator aggregatedExpression
)
#Parameters
Name | Type | Description |
---|---|---|
aggregated |
Criteria |
A Criteria |
#Returns
Type | Description |
---|---|
Aggregate |
An Aggregate |
#Example
Get orders that have items with the IsAvailable
property set to ‘True’.
Expression:
CriteriaOperator.FromLambda<Order>(x => x.OrderItems.Count(i => i.IsAvailable == true) > 0);
Test
Input:
Order | Order | Is |
---|---|---|
Order0 | ||
Item0-0 | False | |
Item0-1 | False | |
Order1 | ||
Item1-0 | True | |
Item1-1 | False | |
Order2 | ||
Item2-0 | False | |
Item2-1 | True |
The result:
Order |
---|
Order1 |
Order2 |
See Also