Constraint question - driving me nuts!

Hey all,

Can someone help me understand the differences between data you can use as the “value” and data you cannot. For example the below screenshot. Why can the “Company State” value but I cannot use the value of the next item for the constraint.

I think if I can grasp how these two elements differ, I’ll be able to build my app much easier.

Hi there, @plazatm… what is the field type of the Sales Rep Company field? It looks like there is a data type called Distributor Company… is the Sales Rep Company field linked to that data type? If so, you should be able to get rid of Company Name in the constraint, and I believe you would be good to go because Company Name is probably a text field, but Sales Rep Company is not.

Anyway, I could be way off here, but with what you are showing, those are the thoughts that come to mind. Hope this helps.

Best…
Mike

Thank you for the response!

I think I understand what you’re saying but when I remove the company name, then I have to give the parent company more details and I’m stuck with the same problem. It’s seemingly a logic loop that keeps going.

My need is that the dropdown should be constrained to the 2 elements shown previously. Maybe it’s just my lack of understanding on the data source.

I wrote this for someone else a while back … might be too basic for you :slight_smile:

There are some concepts to understand to get to grips with Bubble. Types like Texts and Numbers mean what anyone would think they would mean. Lists of Texts or Numbers are also what you would think they mean. So a list of numbers, is not a number, kind of obvious. And a Text type is not a Number type, kind of obvious.

If Bubble expects a Number type and you supply it with a list of Numbers - it will not work, go red, show up in the issue checker, won’t appear as a suggested option in a list, just not work. If Bubble expects a Number and you supply a Text - that won’t work. Also applies to Dates, these things are builtin into Bubble. Bubble just “knows” about Dates, Numbers, and Texts. (and Users)

Bubble ‘Things’ - bit more abstract. If you had a Spreadsheet that stored ‘Things’ (like fruit), it would have columns of attributes (like name, colour) and rows of data. (like apple, red). I could have another spreadsheet (Thing) that stored Things like Cars (with attributes like make and year of manufacture) and have rows like (Tesla, 2020). So now Bubble might expect a Thing of type Fruit but if you try to supply a Thing type of Cars - it won’t work. Same is Bubble expects a list of Fruit, and you try to supply a Fruit - that won’t work. Because you created in Bubble Things of Cars and Things of Fruit - Bubble “knows” what they are, what attributes they have. These Things and attributes of these things just automatically appear in the Bubble Editor.

But a Database like Bubble is much more powerful than a Spreadsheet, so thinking about Spreadsheets only takes you so far before you get to the questions like “how do I link things up?” “How do set a Car on a User?” How do I find all the Users who have Teslas?

So let’s say I want to store on a User what car they have. I can create a field of type “Car” on the User and in the field I could “link” a row of data in the Car list. Let’s say I link a row that is “Honda, 1984” to a User. So I know that this User has a car, and that car is a 1984 Honda. The name of the Car is “Honda”, but there is a row of data that is “Honda, 1984”. There could be another row which is “Tesla, 2020”. Under the covers Bubble does this linking with a Unique Id for every row in the database - you don’t have to do it - Bubble does the linking for you. You don’t need to say “This user has row number 1 of the Cars” - that is what a Database does. (and this is where Bubble is different to a spreadsheet).

So Bubble understands the difference between the name of the car, (Tesla), and the row in the database that is the Car Thing. Bubble knows about the Things you have created, eg Cars, Fruit. It won’t let you in the Editor try to link or assign, things that don’t make sense because they are different types. I can’t search Users for Cars that are Green Apples. I can’t give a User a car of Banana. I can’t set a Users car as a list of Cars. Bubble makes these things Red or simply not appear in the Editor.

If you are building your understanding of the Bubble database from your understanding of Spreadsheets, there is a leap of understanding to make about how you link things. When I am talking to people about how to design databases there is often this really satisfying moment where they say “Oh so that is how you link things up”. :slight_smile:

2 Likes

I’m not sure what you are trying to do, and I don’t understand the second screenshot. In the first screenshot, you are trying to populate a dropdown with sales reps, and you only want reps whose state is equal to another dropdown’s value and whose company is equal to the company you are somehow setting at the page level. If all of that is true and if the field type of the Sales Rep Company field is Distributor Company, then what I suggested should work.

I’m not sure what the group in the second screenshot has to do with anything, but if you can share more details about the setup of the page and what you are trying to accomplish, I’m sure we can get it figured out. After we figure it out, the concepts you are trying to grasp will likely become clearer.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.