SelectQuery.GroupFilterString Property

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

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v19.2.dll

Declaration

[DefaultValue(null)]
[LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)]
public string GroupFilterString { get; set; }
<DefaultValue(Nothing)>
<LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)>
Public Property GroupFilterString As String

Property Value

Type Default Description
String

null

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