filter( )


Filters out items from being used in an aggregation.

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

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

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

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

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

The filter to use to filter out items from being used in the aggregation.

Returns
Return Type:WixDataAggregate
JavaScript
let filter = wixData.filter().eq("year", 2010); let newAggregate = aggregate.filter(filter);
Errors

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

Did this help?