Mixpanel Community Icon

Using the Not In Operator in JQL - Troubleshooting Guide

·
·

Help me with not in operator in JQL This is the event selector: selector: 'properties["$mp_api_timestamp_ms"] >= $start_unix and properties["$mp_api_timestamp_ms"] <= $end_unix and properties["$property"] not in ("test")' this is the error: {"request": "/api/query/jql?project_id=3342724", "error": "UserVisiblePreconditionFailedError: Failed to parse selector string: 'properties[\"$mp_api_timestamp_ms\"] >= 1745816400000 and properties[\"$mp_api_timestamp_ms\"] <= 1745823599000 and properties[\"type\"] not in (\"test\")'\n"}

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Hi Đại N., 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

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    I can help you with the error you're encountering with the "not in" operator in JQL.The issue is that there is no "not in" operator in Mixpanel's JQL segmentation expressions. According to the documentation, JQL supports the following binary operators: LBKS<binary op> ::= '+' | '-' | '*' | '/' | '%' | '==' | '!=' | '> ' | '> =' | '<' | '<=' | 'in' | 'and' | 'or'LBKSThere is an "in" operator, but no direct "not in" operator. However, you can achieve the same result by using the "not" unary operator combined with the "in" operator.Try modifying your selector to use this pattern instead: LBKSselector: 'properties["$mp_api_timestamp_ms"] > = $start_unix and properties["$mp_api_timestamp_ms"] <= $end_unix and not (properties["$property"] in ("test"))'LBKSThe "not" operator is listed in the documentation as a valid unary operator: LBKS<unary op> ::= '-' | 'not'LBKSThis should allow you to filter out events where the property value is "test".Segmentation Expressions documentation provides more details on the available operators and their usage in JQL.

    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.

  • Avatar of Đại N.
    Đại N.
    ·
    ·

    kapa.ai... in ("test") works but ....in ("test", "test2") does not work

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Let me check the knowledge base for you again. One moment! 📚

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    I see the issue you're encountering. When using multiple values with the in operator in JQL, you need to use an array syntax rather than a comma-separated list in parentheses.Try modifying your selector to use square brackets for the array of values: LBKSselector: 'properties["$mp_api_timestamp_ms"] > = $start_unix and properties["$mp_api_timestamp_ms"] <= $end_unix and not (properties["$property"] in ["test", "test2"])'LBKSThe correct syntax for the in operator when checking against multiple values is to use an array (square brackets) rather than parentheses with comma-separated values. This is consistent with how JQL expects array literals to be formatted in segmentation expressions.If you're still encountering issues, you might also try using the != operator with multiple conditions joined by and as an alternative approach: LBKSselector: 'properties["$mp_api_timestamp_ms"] > = $start_unix and properties["$mp_api_timestamp_ms"] <= $end_unix and properties["$property"] != "test" and properties["$property"] != "test2"'LBKSThis would achieve the same result of excluding events where the property equals either "test" or "test2".

    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.