what is wrong about this syntax? I want to check if the “corrected utm source” property is not defined: IF(UNDEFINED(Corrected UTM Source),TRUE,FALSE)
Hi Elena M., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
There are a few issues with your syntax for checking if the "Corrected UTM Source" property is not defined in Mixpanel:
1. The function name should be lowercase if instead of uppercase IF
2. The correct function to check if a property is defined is defined(), not UNDEFINED()
3. You should not use backticks () around property names in Mixpanel expressions 4. Property names should be referenced using the properties["Property Name"]` syntax
The correct syntax would be:
```
if(not defined(properties["Corrected UTM Source"]), true, false)
LBKSOr more simply:
LBKS```
not defined(properties["Corrected UTM Source"])
This is because the defined() function already returns a boolean value, so wrapping it in an if statement that returns true/false is redundant.
According to the Mixpanel documentation on segmentation expressions, the defined() function "determines if a value exists. If a property is not defined on a parent event or profile, this will return false, otherwise this will return true." Custom Properties
The not operator can be used to negate the result of the defined() function, returning true when the property is not defined.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
