corelibraries-devexpress-dot-dataaccess-dot-sql-dot-selectquery-ba9903dc.md
Specifies the filter criteria to add to the current SelectQuery containing grouped/aggregated columns.
Namespace : DevExpress.DataAccess.Sql
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
[DefaultValue(null)]
[LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)]
public string GroupFilterString { get; set; }
<DefaultValue(Nothing)>
<LocalizableCategory(DataAccessStringId.QueryPropertyGridTableSelectionCategoryName)>
Public Property GroupFilterString As String
| Type | Default | Description |
|---|---|---|
| String | null |
A String value.
|
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";
'...
Dim selectQuery1 As SelectQuery = 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";
'...
Dim queryParam1 As New QueryParameter("Parameter1", GetType(Int32), 200)
selectQuery1.Parameters.Add(queryParam1)
selectQuery1.GroupFilterString = "[TotalStock] > ?Parameter1"
See Also