Array
When working with array fields in the CXP, filters allow you to define criteria based on the contents of an array. Array fields typically represent lists of values, such as tags, categories, purchased products, or user preferences. The itemsMatch filter provides powerful options to evaluate arrays based on specific conditions: all, none, and range.
Below is an explanation of how the itemsMatch filter works and how it can be applied in the context of segment creation and filtering.
Array Filter: itemsMatch
The itemsMatch filter evaluates the contents of an array field based on the following options:
All
-
Definition: Checks if all items in the array match the specified condition.
-
Use Case: Useful for ensuring that every item in the array meets a specific criterion.
-
Example: Filter users whose purchased products are all in the "Electronics" category.
-
purchased_products itemsMatch all "Electronics"
-
-
None
-
Definition: Checks if none of the items in the array match the specified condition.
-
Use Case: Useful for excluding arrays that contain specific values.
-
Example: Exclude users who have purchased any product in the "Accessories" category.
-
purchased_products itemsMatch none "Accessories"
-
-
Range
-
Definition: Checks if the number of items in the array falls within a specified range.
-
Use Case: Useful for filtering arrays based on their size or count.
-
Example: Filter users who have purchased between 3 and 5 products.
-
purchased_products itemsMatch range 3-5
-
-