I’m having a hard time implementing some functionality. First, a little bit of background:
I’ve got a few different kinds of things:
- Users
- Data
- Tags
I’ve also got some things that are acting as join tables:
- Users2Data
- Data2Tags
So users can have many data objects, and those data objects can have many users. Similarly with tags: a data object can have many tags, and a tag may apply to many data objects.
I’ve done it this way because I’d like to implement a social component later that can track the prevalence of certain data objects and tags across the user-base as a whole. The “join table” approach is a holdover from how I’d solve the problem in something like Rails or Meteor; my apologies if it’s not the Bubble way.
The functionality that I’m having a difficult time with is letting the user select a group of tags and displaying only the pieces of data that have all of the tags selected; right now, it displays all of the pieces of data that have at least 1 of the tags selected. The approach I’m currently using is:
- User selects a tag
- Tag is added to a list of tags contained in the current user object (couldn’t think of another way to implement this in Bubble)
- List of data objects displayed is updated: I search for all Data2Tag entries where the tag is in the list of tags contained in the current user object and I search for all User2Data entries where the user is the current user
I have a few ideas as to how to implement this, but I can’t quite figure out how to fit them into a Bubble workflow. I was thinking one of the most promising would be if I could search for a list of all data objects through User2Data with user = current user and then convert the tags from all of the associated Data2Tag objects to a list on a per data object basis, I could compare that resulting list of tags with the list of tags contained in the current user object.
I’m having a hard time with the “per data objet basis” part. Any suggestions or tutorials that I might find helpful? Thanks in advance.
It sounds like having a custom state (that is a list of texts) would be best to use for the search. Custom states are remembered at the page-level, and don’t use any workflows since you’re not making changes to the database. This way, a User can select certain tags which are added/removed from the custom state list of texts; and the repeating group constraint would be that the item must contain all of the selected tags. There are a few posts in the forum which discuss creating a custom state list, but feel free to share a link to your app and I can definitely assist in setting this up!