Assign Data Type Depending On City

I’m creating a real estate listing website. When the user enters the listing address I need to be able to assign it an MLS depending on the location of the address. The problem is there are 700 MLS’s in the US and each cover many cities. I could assign cities to each MLS in the database and then extract city from address, and then do something like “when city is x,y, or z… then assign MLS x”, but that would get super long and tedious. I’m sure there is a better way. Is there a plugin that would help with this or a sophisticated way to do it in bubble?

Can you find a CSV / online table that contains a list of cities with their corresponding MLS?
If so, the ‘upload’ tool in the App Data would let you upload the data in a few clicks.

I should be able to get that info, but then how does the logic work in the database? Wouldn’t I have to do something for each client where "when city is…(enter 30 cities here) then MLS = (the assigned MLS for those cities). And then wouldn’t I have to do that 700 times for that workflow since there are 700 MLS’s?

There are better ways :sweat_smile:

If the CSV were formatted with Column 1 being the city Column 2 and Column 2 being the MLS, you’ll be able to import that and create a ‘City’ dataType with a field for name (Column 1) and a field for MLS (column 2). I imagine that MLS’s might have some sort of identifying code/name?

Once you have this dataype, once the user types in their City (or selects it from a dropdown), you could just set their MLS in a single step by referencing the City’s MLS, either by using a ‘Do a search for city’ using the name as a constraint, or referencing the dropdown’s value.

Be careful with homonymous cities, as the US especially has a lot of them. How many Springfields are there :grin: You’ll probably have to use the City’s State too or some other form of unique id.

You can also work with a csv that works the other way; one which lists all the cities in an MLS. The logic is similar. But nonetheless definitely don’t need a 700 step workflow.

Thank you. I’ve only been using bubble for 3 months so I didn’t even know to explore the CVS route. I’ll give this a try. Thank you so much!

Just out of curiosity, would using geofencing with google maps api be a possible solution?

Yes that would work, but i would be surprised if the geofence data were more readily available than the CSV data.
It’s also slightly more complex to implement, but sure it’s possible. You’ll also need to rely on users allowing location permissions on your webapp.

Did you find geofence data for MLSs?

Some MLS’s have a coverage map instead of listing out the cities they cover, so I was curious about going that route. I can find the cities though. The CVS route seems more straightforward to implement s you alluded to. Thanks for your help!