having( )


Filters out groups from being returned from an aggregation.

The having() function refines a WixDataAggregate so that it only includes groups from the aggregate's grouping which match the specified filter criteria.

To create a filter, use the wix-data filter() function.

Filtering using having() takes place after grouping is performed on the aggregation. To filter items before grouping, use the filter() function.

Note: Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.

Method Declaration
Copy
function having(filter: WixDataFilter): WixDataAggregate;
Method Parameters
filterWixDataFilterRequired

The filter to use to filter out groups from being returned from the aggregation.

Returns
Return Type:WixDataAggregate
JavaScript
let having = wixData.filter().gt("maxPopulation", 1000000); let newAggregate = aggregate.having(having);
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?