A simple IF value is X, then... or Set Group State to X

I apologize for the large number of questions I’m posting nowadays, but I’m finding my way from thinking as a very novice programmer, to switching to Bubble. And don’t get me wrong, I’m in AWE of how robust and well designed this product is. A true game-changer and democratizer of app development.

There is a challenge however, that I keep running into constantly, which in my head really should not be complicated, but is really hard to do in Bubble. I find it near impossible to refer to a set value in the database, unless the user picks that value from a list specifically (RepeatedList/Dropdown/etc), or you can fetch it from the database (User:Gender)

Example
I want to set the State of a Group to a specific Field value upon load. However, I can’t point to that value in any way, You can’t search for value containing X, because that returns a list.

.
I just find it so strange that you cannot refer to a data point at all, if not the user specifies it for you or it’s already saved in the database.

I have solved it by creating a Data Type called ValueFetcher, with lots of field that point to the right value. For example, it has a field called Female, which only consists of one entry (Female) of the Data Type Gender. Whenever I need to do an IF, based on gender, or set a state, I can call upon the ValueFetcher:Female:First entry to get that specific gender. But it just seems really database heavy and not intuitive. But I may be stuck in a traditional developer mindset.

Please don’t get me wrong, this is not a rant, I’m truly curious, and very open to the possibility that I simply have not fully grasped the basic architecture of Bubble yet. I appreciate all input!

–ignore my original response, it basically was pointing at what you did to solve the issue.

If I understand you correctly, in the designer, you want to have a lookup that pulls the valid options for a give field to reduce the risk of entering a wrong value.

I keep a list of the valid options in the notes for a types field that I can refer to.

1 Like

I may not be understanding this correctly, but are you trying to set the value of the custom state, without doing a search? If so, you can type this in manually (it may take a backspace or two to get rid of the ‘Search…’ dropdown, and then you’ll be able to type it in and press enter).

Then you can create conditional statements such as: "When Add Employee’s Gender is “Female” ". Not sure if this is what you’re looking for, but wanted to share just incase. :slight_smile:

2 Likes

As long as you spell it right … The above is the way to go.

But OP is right, bubble has no native support for enumerations like this. That would be nice, being able to specify a list of values on the database and have them available when you want to enter a constraint.

1 Like

I never thought of combining Do a search for (which returns a list), with First item, (which indeed returns a single item), and indeed is the way to go, provided you spell it right.

Thank you for helping me out guys and gal :smile: