Null handling
You can't use the literal null in filter criteria. When a profile doesn't include a trait that your criteria reference, any comparison against that trait evaluates to false. The profile is therefore excluded from the results instead of causing an evaluation error.
profile.trait.Account.status == "active"
A profile with no Account.status trait doesn't match this condition. It is excluded, just like a profile whose Account.status is set to any value other than "active". The same behavior applies when you negate the condition with the ! operator. For example, the following criteria also excludes profiles that have no Account.isTest trait:
!profile.trait.Account.isTest
To distinguish "the trait is missing" from "the trait doesn't equal this value," use the has() function.
has(profile.trait.Account.status) && profile.trait.Account.status != "active"
To include profiles that are missing a trait when you negate a condition, check for presence explicitly:
!has(profile.trait.Account.isTest) || !profile.trait.Account.isTest
Although null isn't valid inside filter criteria, a missing trait can still appear as the JSON value null when it is projected into a snapshot through snapshot variables.
- Review supported operators and precedence.
- Learn about type matching.
- Review example criteria for common filtering patterns.