# Function exclude
exclude(
filter
,input
?):Filter
Creates a filter that excludes items matching the given filter from all items or from items matching the optional input filter.
# Parameters
Parameter | Type | Description |
---|---|---|
filter | Filter | Filter to exclude |
input ? | Filter | Input filter to exclude from, on the same attribute. If not provided, the filter excludes from all items. |
# Returns
A filter representing an exclusion of the given filter from all attribute members or from the optional input filter
# Example
Filter for items where the country name does not contain the letter 'A' from the Sample ECommerce data model.
filterFactory.exclude(filterFactory.contains(DM.Country.Country, 'A'))
Filter for items where the country name starts with the letter 'B' but does not contain the letter 'A' from the Sample ECommerce data model. This filter will match countries like 'Belgium', but will not match countries like 'Bermuda'.
filterFactory.exclude(
filterFactory.contains(DM.Country.Country, 'A'),
filterFactory.startsWith(DM.Country.Country, 'B')
)