Skip to main content

SelectQuery.GroupFilterString Property

Specifies the filter criteria to add to the current SelectQuery containing grouped/aggregated columns.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

[LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)]
public string GroupFilterString { get; set; }

Property Value

Type Description
String

A String value.

Remarks

The GroupFilterString property allows you to filter the result set returned by SelectQuery if it contains grouped/aggregated columns. For example, the following query will return only categories that contain a specific number of products.

//...
SelectQuery selectQuery1 = new SelectQuery("MyQuery")
    .AddTable("Products")
    .SelectColumn("ProductID", AggregationType.Count, "ProductsCount")
    .SelectColumn("CategoryID")
    .GroupBy("CategoryID");

selectQuery1.GroupFilterString = "[ProductsCount] > 5";

To pass a QueryParameter (which can be accessed using the SqlQuery.Parameters property) to the filter string, precede the parameter name with the ? sign.

//...
QueryParameter queryParam1 = new QueryParameter("Parameter1", typeof(Int32), 200);
selectQuery1.Parameters.Add(queryParam1);

selectQuery1.GroupFilterString = "[TotalStock] > ?Parameter1";
See Also