Check if one list contains at least one element of another list

I have two lists, one of song characteristics, and one of user interests. I want the repeating group to show songs where at least one of the song’s characteristics is also at least one of the user’s interests. Right now, I am doing this:

Repeating Group Data Source: Search for Songs: filtered
List Filter Constraint: Advanced: This song’s characteristics intersect with Current User’s Interests:count > 0

I thought the above would work, but it does not. Would anyone have feedback on what would work?


Make the user have a list of characteristics … or inversely … make the song have a list of interests.

For the intersection to work it needs to find a common entity in both lists. Right now there are two entities. No way an intersection can happen.

Thanks for your response! There are common entities in both lists. For instance, a song’s characteristics might include ‘Jazz’, ‘Pop’, or ‘Upbeat’. A user’s interests are essentially what they want their songs to have - so their interests would also include things like ‘Jazz’, ‘Pop’, or ‘Upbeat’.

I see. Thanks.

Please advise:
Is a characteristic a data type?
Is an interest a data type?

Interests is a field within the ‘user’ data type (a list of texts)
Characteristics is a field within the ‘song’ data type (a list of texts)

Got it.

I suggest you experiment converting them to data types or option sets. If you need a user to be able to create/delete them then data types is the way to go.

Consider using just one data type. Perhaps like this:

title (text)

interests (list of interests)

interests (list of interests)

With the above database structure the intersection will find at least one … This song’s interests intersect with Current User’s Interests:count > 0

Hope this helps! :slightly_smiling_face:

Thanks for the advice. I was wondering, should that matter? Both song characteristic and user interests evaluate to a list of texts. If there are no similarities between the two, I don’t want them to intersect

The suggestion provided is for those instances when you want it to matter.

In short, you could set up the rg to search for songs with no conditions. Just freely search and show all songs.

But, you could add a dropdown of interests above the rg to act as a filter when you want the rg to display songs that have a selected interest of the dropdown.

If so, then you would the activate the intersection expression so that only songs that have that interest are shown.

The UX you provide for your users is up to you :slightly_smiling_face:

Best of luck with your project. :+1:t2:

The UX isn’t what I’m concerned about - I have something incorrect with the intersect function that is preventing bubble from finding songs that have at least one characteristic in common with the users’ interests.

This should work - I just set up a quick test using exactly the same set up you described, i.e.

Interests is a field within the ‘user’ data type (a list of texts)
Characteristics is a field within the ‘song’ data type (a list of texts)

It worked fine for me, so I’m not sure why it’s not working for you - there must be something else missing in your setup somewhere.

What exactly is the issue? Is nothing showing in your RG? Or everything? Or just the wrong things?

Maybe some screenshots of your data structure and RG filter etc. might help someone to identify the error.


Yes - I had other things wrong. I had a single test I kept doing where a characteristic was ‘Hip hop’ and the interest was put in as ‘hip-hop’. I need to put in some data validation

Any reason why data might not show in a repeating group?

I have set up my constraints just like you described but the data isn’t displaying in the repeating group. The lists that are intersecting contain data that is identical in format and text

Hello @hoyasaxa welcome to the community!

Check privacy rules in the database

1 Like

Thanks! I checked the privacy and seemed to be working totally fine. I’m trying to create an interface where two users who follow the same thing see each other’s posts but not posts of people who don’t follow at least one of those same things.

I think there’s somehow a problem with the two lists I’m intersecting after all…

The values of list 1 are generated by adding all the inputs from a user in a field and entering them at the same time.

The values of list 2 are generated as the user interacts with things over time.

The result seems to be:

List 1: (A, B, C, D)
List 2: (A), (B), (C), (D)

When I perform the intersection a space that’s inserted after or before the commas seems to be blocking the success of the action.

Does this make sense? Anyone know or a workaround?

nvm figured it out. changed one of the data creation parameters to a “add list” instead of just “add”


I’m struggling with the check if one list contains at least one element from another list.

I have a date type named Invoices.

  • It exists two categories of invoices :
  1. Invoice AE
  2. Invoice Client

Each invoice has a field (list of tickets) named tickets and has a text field named “invoice_id”.

I am currently building a page of invoice type and it is a client category.

I’d like to search all the AE invoices category that contains at least one ticket of the Current Page Invoice of client category.

Thank you in advance for your help.