Show if list A contains any item in list B

Sorry I’m a bit late, I hope what I did would help you too.

The solution didn’t work for me. I had to incorporate a ‘first choice’ question into my service flow to work around this. So it became list contains value of ’ first choice’ rather than list A containing any value from list B.

To be honest it isn’t the best but I just couldn’t dwell on it any longer.

Have you found a solution yet? Need this

I am trying to do the same thing.

I want to compare a bunch of orders and intersect their dates to pull a list of orders with conflicting dates. Advanced Filtering is not working for me.

Anyone have a solution yet?

Same problem here.
Why we don’t have a “contain any of a list”?

3 Likes

@hkhalil1803 @hetnon.freitas

This guide by @NigelG may be helpful

http://forum.bubble.io/t/sql-joins-vs-bubble/25806?u=cmarchan

1 Like

Try the advanced filter “:intersect with” and you can use “:count>X” at the end to control the number of common items in each list.

If you search the forum for intersect with you’ll see some examples of this method.

2 Likes

Ed727, it doesn’t have this option inside the Search. What I’m trying is to do a search for the things (Item) which have a list of things (Containers). For a given specific Item (Item A, let’s call), which has a number of speficific containers (C1, C2, C3, for example) I need to find all the other Items that have at least one of these in their Container list.

Intersect doesn’t work.

I will have a look in the guide from @NigelG

@hetnon.freitas

When filtering you can always do nested searches…

In essence, search for, advance filter, search for again…

Very non-performant though … but it all depends on circumstances

Thanks. I will give it a go and post here later.

1 Like

The intersect with option is an advanced filter, so you won’t find it within search. Use the :filtered after your “Search for” and then you’ll see it. The expression would be something like… Item A’s Containers intersect with This Item’s Containers: count>0.

hum!! I will try this one too.

ok, so none of this still solve my case. I will go through the problem once again.

I have Items. Items have multiple fields, including the field Containers, which is a list of Containers. Every time I create an item I say the values for all the fields, and multiple values for the containers.

But before creating a new Item, I need to know if an Item like that already exists. So I test to find any Item that match those fields. I do a “Search for” the type Item, and test all the fields using “=”. Straight forward. But in the “Search for”, when the field is a list, the only option that appears to test is: contains, doesn’t contain, is empty, is not empty.

First choice in mind is to see “contains”. But with this option I can only test if a certain WHOLE list of containers appears in the a list of containers of any of the Items in the database. But that’s not what I want.

As a item can have any list of container, I need to need if at least 1 container of the item I’m trying to create intersects in the list of containers of any other item. But intersect option DOESN"T exist when we are inside a “search for”.

Thanks for the SQL prompt, but I know the SQL commands. That’s not the problem. the problem is how to use “Intersect” or anything else more than just the 4 options (contains, doesn’t contain, is empty, is not empty. )

I think I got it!!!

I just do the Search for using the individual fields for Item, but I keep going to containers, and then I intersect with another list of containers, outside the Search for, then I count the results and if they are 0 I’m good to go!

1 Like

Was looking around for the most simple way to solve the “If List intersects with other List” problem. This was the most elegant solution… thanks!

1 Like

Can you show a screenshot of how you’ve got this setup, please? This is a problem I’m looking to solve also!

image
see if that help.
I don’t even remember anymore how it does and I would have to have a look

1 Like

Hello,

I struggled with this problem yesterday too, I didn’t really find a clear answer on this forum so I’m making my own with what I find a clear explanation:

Problem: You want to find all the lists that have at least one object in common with your initial list.
Solution:
You first make a “do a search for” then you select your “Type of your Thing” then you select “Filtered” (as the first picture)

When you do “filtered” another window will show up. In this window you select “Advanced” and then you select one of the lists, then you do “intersect” (which take the intersections of the two lists) and then you set the other list. You then count the elements and add the condition > 0. (As in the second picture)

Basically it does this:
list 1: {A, B , C}
list 2: {B, D}

list1 intersect list2 → {B}
{B}: count → 1
1 > 0 → “yes”

step1

step2

I hope this helps

4 Likes

this works perfectly…thanks

I just figured out how to do that kinf of filttering, you just have to make an advance filtter, then intersect the item list’s you are searching for, with the list you are using to filter, and then check if that intersection is greater than 0, if then, the list contains any item of the list.
Here is an example from my app:

In my app, “Persona Responsable” is a list of users and “Selected veterinary’s vet” is other list of users

Hope it could help

I’ve been struggling with getting a side menu to display items if the user’s account type matched the dashboard cards account type. Such an easy fix! I love you