I use quite a lot of boolean variables in my app and use toggles to switch them on or off. However, in the beginning they are empty.
For my user, it’s important to see the difference between variable is ‘no’ and variable is empty. I want to use a condition for this, but the only conditions that are available are is ‘yes’ and is ‘no’.
I know that I can change all the variables to text types and use dropdowns, but I hope there is a quicker solution.
Random brain-fart: what if you do a condition like:
[variable] is not "yes" AND [variable] is not "no"
Will that catch it?
I tried that already…when the variable is empty in the database the debugger gives for the condition ‘variable’ is no : Yes. So I think it interprets an empty value as no, which would be a huge bummer for me
A boolean only has two states, on/off, yes/no, true/false. I’m afraid you are getting caught in the ‘oh, crap, why did I set it up like that?!’ position that every single one of us have been in
Exactly I could at least try to get out of it …
A Bubble boolean has three. True, False, Null.
And that is why we can get ourselves into quite a mess
(not just bubble, but anything where you cam have null values).
It sort of does that internally, but if you format a boolean as text, then no (null no) comes out as blank. Although not empty it seems, which would have been a nice workaround.
I stand corrected I was under the impression Bubble treated null as False or, in other words, it was either True or Not True.
Is that Not True?
I think it probably does but I just tied myself in knots trying to tell Bubble that if it is No as in Null and not No as in No then tell me it is empty
And creating a list of No and Yes is much harder than I had imagined.
The problem is that you can’t design a condition with a boolean that has value null…
… if there is a way I will let you know.
I think it’s possible that because
We’re looking for Bubble developers to join our team: https://jobs.airdev.co/
Yes, it shows as ‘no’ in the debugger but won’t then translate if you try to evaluate as text or number.
Note that for at least two days, if you had defaults (like yes, no, nothing) when initializing your variables, then the value was null instead of Yes No. As Nigel @NigelG mentioned, it does not produce the expected result. So the best way is to say < > of “Yes”.
@kevin12, this seems very Truthy…
Since null is no, i solved my specific case by turning “show image” into “hide image” such that all pre-existing nulls are now no, and I can match for that as I wanted it by default, and only future items are set as yes will be hidden. Won’t solve every case.
I just introduced a “boolean” option set and set the related field to that type - now it can be “yes”, “no” or empty