let's say a have 10 user properties (it's all BOOLEAN type, e.g has_condition=TRUE), i wanna create a custom user properties that concat all these properties when it's TRUE with a , delimiter, ignore FALSE, how do i do that?
Hi Quan T., 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
Short answer: you can build this with a Custom Property using LET, IF/IFS, LIST functions (via map/filter), and string join logic. However, the knowledge sources don’t show a built‑in “join” function for strings, so the exact one-shot “join by comma” isn’t explicitly documented. We can still do it by constructing a list of labels for the TRUE booleans and then reducing it to a comma-separated string using map/filter and addition (+) for concatenation.Example approach:
- Start with your 10 boolean user properties, e.g. has_a, has_b, …, has_j.
- Turn each into either its label or undefined based on its value.
- Filter out undefined values.
- Concatenate with commas using +, since + supports string concatenation. [Functions; Numeric operators; Constants]Here’s a concrete formula you can adapt: LBKSlet( candidates, [ if(has_a, "A", undefined), if(has_b, "B", undefined), if(has_c, "C", undefined), if(has_d, "D", undefined), if(has_e, "E", undefined), if(has_f, "F", undefined), if(has_g, "G", undefined), if(has_h, "H", undefined), if(has_i, "I", undefined), if(has_j, "J", undefined) ], let( vals, filter(x, candidates, defined(x)), let( n, len(vals), if( n == 0, "", if( n == 1, vals[1], // Concatenate first two, then append the rest with leading commas let( head, vals[1] + "," + vals[2], let( tail, map(k, [3,4,5,6,7,8,9,10], if(k <= n, "," + vals[k], "")), head + sum(tail) // sum over strings concatenates via + ) ) ) ) ) ) )LBKSNotes:
- + concatenates strings, as documented. <https://docs.mixpanel.com/docs/features/custom-properties#numeric-operators|[Numeric operators>]
- if and defined come from the function set. [Functions; Functions]
- filter, map, len are documented list helpers. [Functions]
- undefined is an allowed constant to drop values and then filter them out. [Constants]If you prefer something simpler and can live without perfect “no trailing comma” handling, you can also concatenate conditionally with leading commas and strip one in the UI, but the sources don’t document a generic string trim function, so the above pattern avoids trailing commas purely with documented functions.Limitations:
- The docs don’t show a dedicated join function, so we rely on map/filter/len and string concatenation. [Functions; Numeric operators] - Make sure the original properties are booleans or cast with boolean() if needed. [Functions; Data types]Tip: Build and test this as a local Custom Property first (Apply), then Save to reuse. [Creating a custom property]
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.
