<@U01TCPDB58C> When I’m setting up the metrics, is...
# contributing
h
@future-teacher-7046 When I’m setting up the metrics, is it possible to use a boolean based condition, not just a string?
f
I think that would be hard to do in the current conditions UI without breaking things. What do you think about using a textarea instead where you could enter something like a javascript condition like this?
Copy code
event.properties["skipped_trial"] === true 
&& ...
h
if that’s what I gotta do, i’ll do it
f
Would you prefer keeping the current UI and just adding a datatype dropdown for each condition (defaulting to "string")?
h
I think that would be a bit more straightforward yeh. At least for Mixpanel, i think it’s string and boolean. Not sure they use other datatypes natively, do they? dates maybe, although I’ve been casting my dates to unix strings
f
I guess for Mixpanel at least, we can probably auto-detect the data types and do the conversion automatically. I'll do some testing
h
yeh i think you already do this for numbers right? Looking at my events we have strings, numbers and booleans
f
I don't believe we're doing anything special for numbers.
h
ahh well i guess I dont use any in my conditions yet either. We may also have a type mismatch if someone tries to use a number in the condition then too
hey @future-teacher-7046 do you have any ETA on the type auto detecting for Mixpanel?
f
Should be able to get to it by end of this week
h
awesome thanks
f
@helpful-hydrogen-62495 I pushed a fix for this. It should handle booleans and numbers correctly now. Let me know if you notice any issues.
🙌 1
h
Just looked at the query, so just so I understand, you’re casting the numbers and booleans to string?
with the
Copy code
+''
f
yeah, javascript is weird.
true + '' == 'true'
h
nvm
f
numbers are the same when doing equality (
"10" == "10"
). The difference is when doing
<
or
>
we're detecting that it's a number and doing the comparison correctly. Otherwise, you end up with weird stuff like
"10" < "9"
1