Skip to main content

AggregateOperand.Count(CriteriaOperator) Method

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.1.dll

NuGet Package: DevExpress.Data

Declaration

public AggregateOperand Count(
    CriteriaOperator aggregatedExpression
)

Parameters

Name Type Description
aggregatedExpression CriteriaOperator

A CriteriaOperator object which specifies the aggregate expression. This parameter may be ignored in certain circumstances.

Returns

Type Description
AggregateOperand

An AggregateOperand object which calculates an aggregate expression.

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

OrderItem

IsAvailable

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