https://www.growthbook.io/ logo
h

helpful-hydrogen-62495

05/24/2022, 4:11 PM
@future-teacher-7046 When I’m setting up the metrics, is it possible to use a boolean based condition, not just a string?
f

future-teacher-7046

05/24/2022, 4:15 PM
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

helpful-hydrogen-62495

05/24/2022, 4:15 PM
if that’s what I gotta do, i’ll do it
f

future-teacher-7046

05/24/2022, 4:16 PM
Would you prefer keeping the current UI and just adding a datatype dropdown for each condition (defaulting to "string")?
h

helpful-hydrogen-62495

05/24/2022, 4:19 PM
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

future-teacher-7046

05/24/2022, 4:23 PM
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

helpful-hydrogen-62495

05/24/2022, 4:24 PM
yeh i think you already do this for numbers right? Looking at my events we have strings, numbers and booleans
f

future-teacher-7046

05/24/2022, 4:26 PM
I don't believe we're doing anything special for numbers.
h

helpful-hydrogen-62495

05/24/2022, 4:32 PM
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

future-teacher-7046

05/26/2022, 2:19 PM
Should be able to get to it by end of this week
h

helpful-hydrogen-62495

05/26/2022, 2:20 PM
awesome thanks
f

future-teacher-7046

05/27/2022, 11:02 PM
@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

helpful-hydrogen-62495

05/27/2022, 11:06 PM
Just looked at the query, so just so I understand, you’re casting the numbers and booleans to string?
with the
Copy code
+''
f

future-teacher-7046

05/27/2022, 11:17 PM
yeah, javascript is weird.
true + '' == 'true'
h

helpful-hydrogen-62495

05/27/2022, 11:20 PM
nvm
f

future-teacher-7046

05/27/2022, 11:21 PM
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