Forum Academy Marketplace Showcase Pricing Features

Improved Yes/No (nullable, works in dropdowns)

Good evening bubblers!

As has been pointed out in other threads (Empty default yes/no state is read as "no" for example), “no” in bubble is equivalent to empty. While this can be very useful in certain situations, it also can prove a challenge in others.

For example, I have an optional search filter for whether a User is a student. My initial thought was to store this as an “isStudent” yes/no field on the User thing and then do a search for Students where “isStudent” is the same as a selected dropdown. However, I ran into two issues:

  1. There isn’t a good way to make a “yes/no” dropdown
  2. If a user hadn’t specified yet whether they were a student, their “isStudent” is set to empty. However, since in bubble, no = empty, these Users were being returned in explicit searches for “not students”.

The Solution:

With the power of Option Sets, we can create our own Yes/No field which will be nullable and work in dropdowns:

  1. Go to the option set tab, and create a new Option Set called “Yes/No (custom)”
  2. Create an attribute called “yes/no”, and set it to type “yes/no”
  3. Create an Option called “Yes”
  4. Create an Option called “No”
  5. For both “Yes” and “No”, click “modify attributes” and set its “yes/no” attribute to the appropriate value
  6. Set your desired yes/no database field to type “Yes/No (custom)”
  7. In your dropdown, set the style to dynamic, the type to “Yes/No (custom)”, and the caption to “This Option’s Display”
  8. Done!

Hope this helps someone!

7 Likes

Hi Austin

Thanks a lot for this solution! I was battling with this and you saved me.

Regards

Deepak