I have an event property called products, which is an array that contains id, name, price, quantity. I want to extract id and then create a custom property to filter where id in (1,2,3)
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
Based on the knowledge sources, I can help you work with your list of objects property and create a custom property to filter by specific IDs.Since your products property is a list of objects, you can use custom properties with the any function to check if any product ID matches your criteria.Here's how to create a custom property that checks if the ID is in (1, 2, 3): LBKSany(product, products.id, product == 1 or product == 2 or product == 3)LBKSThis custom property will evaluate to true if any product in your products array has an ID of 1, 2, or 3, and false otherwise.According to the custom properties functions documentation, the any function "evaluates to TRUE if the given expression is true for any value in the given list."Once you create this custom property, you can:
1. Apply it locally to your report, or
2. Save it globally for reuse across reports (available for Growth and Enterprise plans)Then you can use this boolean custom property as a filter in your reports to show only events where at least one product has an ID of 1, 2, or 3.Note: When working with list of objects properties, you can access nested properties using dot notation (like products.id to access the id field within each object in the products array), as shown in the list of objects documentation.
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.
Let me check the knowledge base for you again. One moment! đ
Based on the knowledge sources, when creating a custom event property through the Mixpanel UI for a list of objects property like products, you can extract the id values using dot notation.Here's the formula to extract the list of IDs from your products property: LBKSproducts.idLBKSAccording to the list of objects documentation, when you select a list of objects property in Mixpanel, "you will be prompted to select another property common to the objects in the list." This means you can directly access nested properties like id using the dot notation products.id.This will give you a list of all the id values from the objects in your products array. You can then use this extracted list property in filters and breakdowns just like any other list property.To create this in the UI:
1. Navigate to where you're creating your custom property
2. In the formula bar, enter: products.id
3. Apply or Save the custom propertyThis custom property will return a list of IDs that you can then filter or break down by in your reports.
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.
