Filter functions

Filter functions are used to filter data within arrays in Profile Query Language (PQL). More information about other PQL functions can be found in the Profile Query Language overview.

Filter

The [] (filter) function allows filters to be applied to an array and return a subset of the array which match the specified condition.

Format

{ARRAY}[filter]

Example

The following PQL query gets all events which have at least one product item with an SKU equal to “PS”.

xEvent[productListItems[SKU="PS"]]

Up operator

The ^ (up) operator allows you to refer to properties in upper levels of filters.

Format

{ARRAY}[{FILTER_1}[{FILTER_2} or ^{PROPERTY}]]
Argument
Description
{ARRAY}
The array that is being filtered.
{FILTER_1}
The outer layer of filtering.
{FILTER_2}
The inner layer of filtering
^{PROPERTY}
The property that is also being filtered on. Due to the ^, it is checking a property based on filter1.

Example

The following PQL query gets all events which have at least one product item with an SKU equal to “PS” or have a person whose gender is female.

xEvent[productListItems[SKU="PS" or ^^.person.gender="female"]]

Next steps

Now that you have learned about filter functions, you can use them within your PQL queries. For more information about other PQL functions, please read the Profile Query Language overview.

recommendation-more-help
770bc05d-534a-48a7-9f07-017ec1e14871