# Function union

union(filters): Filter

Creates a filter representing the union of multiple filters on the same attribute. The resulting union filter filters on items that match any of the given filters.

To create 'or' filters using different attributes, use the or() function.

# Parameters

Parameter Type Description
filters Filter[] Filters to union. The filters must all be on the same attribute.

# Returns

Filter

A filter instance

# Example

Filter for countries that start with the letter 'A' or end with the letter 'A' in the Sample ECommerce data model.

filterFactory.union([
  filterFactory.startsWith(DM.Country.Country, 'A'),
  filterFactory.endsWith(DM.Country.Country, 'A'),
])