How to show DB entries that match user input?

On Page 1 of my app, I ask users a series of questions. One of the questions is “In what state did you receive medical care?” which is a search box of the 50 US states.

On Page 2, I’d like to display a list of non-profits that operate in their selected state. I’ve got a DB view containing a list of non-profits with 2 columns: Name and State. So if the user answered California on Page 1, I’d like to display all the Names from the DB that have California in the State column (same row).

This seems relatively simple and yet I’ve hit a wall on how to get it done. I’ve got a repeating group to display the output, which I set to Data Source = Search for Non-profit’s Name, but when I try to add a filter to only show Non-profit’s Names which have the same corresponding State as the User’s input from Page 1, the constraint is invalid. Has anyone successfully implemented something like this that could point me in the right direction or knows of a tutorial/guide covering it?


question

Hi there, @dillonfisc1… if I understand your post correctly, you want a search for non profits where the non-profit’s state is the same as the current user’s state, right? If that is correct, your Data source should be Search for Non-profits, and you would add a constraint to the search where State = Current User's State. Want to give that a shot and see if it produces the desired result?

Oh, and if you happen to be new to Bubble (as opposed to just new to the forum), you will likely run into the same issue that lots of new (and even not-so-new) folks are running into these days, and that is the fact that Bubble sets a default privacy rule on your data types. So, you will want to make sure that any privacy rules that are set on the Non-profits data type allow the repeating group’s data to be shown to the current user.

Hope this helps.

Best…
Mike

1 Like

That was it. Changed Data Source to Search for Non-profits rather than Search for Non-profits Name and then added the constraint as you suggested. Also updated the text cell to Current cell’s Non-profit’s Name. Thank you!

1 Like