How do I check whether or not an Item is in a list?

How do I check if an item (Any item) In a list, is present on another list of the same datatype?

It would be nice if bubble included a feature like this :point_right:t5: LIST A contains LIST B ANY ITEM

Hi there, @primedevs… check out the intersect with option… that should get you what you need.

Best…
Mike

2 Likes

And just a lil more color here:

List_A :intersect with List_B

returns a list that contains all items common to both lists. If there are no items in common between A and B, this list will have zero items.

So, to use this as a boolean expression in a Condition or whatnot, you could write (for example):

List_A :intersect with List_B :count > 0

or

List_A :intersect with List_B :first item is not empty

:point_up: Either of those expressions will be true (yes) if the two lists have any items in common.

6 Likes

Hello ! I’ve something similar to do :

2 lists with same datatype. I display the list for user #1 and want to change the font color of items that match with current user #2 's list items

I tried this but seems Bubble s wainting for something else :

image

@Sarah_Esteve A condition would expect a yes (true) or no (false).

So, to use this as a boolean expression in a Condition or whatnot, you could write (for example):

List_A :intersect with List_B :count > 0

if you check the issue tracker, most likely it will say that Bubble expects a Yes or No but right now it is a list of items.

thank you for responding @casheets123 !

I still don’t understand how to change the font color for each item in common…

It’s for now changing all the items color

image

Or maybe I need to display 2 blocks : one wit common items and the other one with not in common