Need help displaying category data on a page that is specific to a common piece of data with the user

I think the solution to this is probably simple but my brain is blanking for some reason.

Background: I’m a first time bubble.io user, looking to build an app that houses information about animals for different rescues. Within this webapp there will be a page called Animals for example, that will display all of the animal types that said rescue has. Selecting an animal from that page will direct the user to an Animal List page, that lists out all animals that match the Animal-type of what was clicked on the previous page, as well as they are specifically animals from the users rescue.

It is possible i have the database set up incorrectly, but other things have worked so far… I have 3 data types: Animals, Rescues, Users.
Each user is assigned to their specific rescue, each animal gets assigned to the rescue of the user that adds the animal to the app. Now, I opted to go for an Option Set during set up so that the user selects the animal type from a drop down to avoid misspellings/nuance and having the data be a mess.

So what i’m looking for help with now is that on the Animals page, i want it to ONLY list the Animal-Types that 1. Have an animal associated with it, and 2. the Animal itself has the same Rescue name as the User.

I have attached a few screenshots of the DB set up (below).

Now, for Animals page set up. I have the Content Type of the page as “Animal”. I have a repeating group on the page that has the Content Type of “Animal-type” and data source of “All Animal-type:unique elements”. Now, i’m not sure where to go from here to be able to filter it down to ONLY show the animals that match with the users rescue.

Thank you for your help!!!



Hi there, @langworthya… in general, your data types look reasonable to me, although, I don’t think you need the Animals field on the Rescue data type, and if you do, you probably intended for it to be a list field (if that is the case, you would have to delete the field and create a new one that is a list). Also, using an option set for the animal types is the way I would have gone, too.

If I have understood your post correctly, I don’t think you need to set content types for your pages. On the page where you want to display the animal types that have an animal associated with them at the rescue associated with the current user, I believe this data source would do the trick.

When it comes to showing the animals at the rescue, I believe this privacy rule should take care of constraining the search (although, it wouldn’t hurt to add the same constraint shown above) because you have a rescue field on both the Animal and User data types.

With that rule in place, the user will not be able to see animals that are associated with any rescue other than their own, and if you constrain the displayed animals to those that have the selected animal type, you should be good to go.

Anyway, I hope what I wrote makes sense, and I hope it helps you get further down the path toward helping rescues and animals (which is a really great cause, if you ask me).

Best…
Mike

Thank you so much for your response!

I thought about privacy rules after posting, so i’m glad that I was on the right track :slight_smile:

THAT DID IT!!! Your suggestion for showing the specific animal types of animals at that specific rescue was a success. What a relief. Thank you again!

Anne

1 Like