Common filtering patterns
profile.trait.Account.plan == "enterprise"
profile.trait.Account.status == "active" && profile.trait.Account.country == "US"
Use ! to invert a condition. Field access has higher precedence than !, so you don't need parentheses around a single field reference.
!profile.trait.Account.isTest && profile.trait.Account.status == "active"
Use in instead of chaining several == comparisons with ||.
profile.trait.Account.country in ["US", "CA", "MX"]
Because address references always return lists, check for membership or presence instead of comparing them directly to a string.
"jane@example.com" in profile.address.email
has(profile.address.phone)
profile.trait.Account.status == "active" && profile.address.email.exists(e, e.endsWith("@example.com"))
profile.trait.Account.lifetimeValue >= 100 && profile.trait.Account.lifetimeValue < 1000
If a trait might be missing and you want to exclude those profiles explicitly, pair the comparison with has().
has(profile.trait.Account.lastPurchaseDate) && profile.trait.Account.lastPurchaseDate > timestamp("2026-01-01T00:00:00Z")
You can also apply arithmetic operators to combine multiple traits into a single derived condition.
profile.trait.Account.lifetimeValue - profile.trait.Account.totalRefunds > 500
profile.trait.Engagement.emailOpens + profile.trait.Engagement.smsClicks >= 10
String concatenation with + lets you build a composite value to compare against.
profile.trait.Contact.firstName + " " + profile.trait.Contact.lastName == "Jane Doe"
Use the ternary operator (?:) when the condition you want to filter on depends on another trait. It evaluates a condition and returns one Boolean when it's true and another when it's false.
profile.trait.Account.plan == "enterprise" ? profile.trait.Account.lifetimeValue > 10000 : profile.trait.Account.lifetimeValue > 1000
- Review operators and precedence when combining several conditions.
- Review the complete functions reference.