Forum Academy Marketplace Showcase Pricing Features

Show if list A contains any item in list B

I believe “Contains list” only returns yes if the first list contains all the entries from the second list?

I.e. this would not work for matching User A to User B if any, but not all, of the preferences match. If you are looking to match two users with 100% identical preferences Contains list would work.

Yeap :+1:t2:

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”?

1 Like

@hkhalil1803 @hetnon.freitas

This guide by @NigelG may be helpful

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!

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

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

this works perfectly…thanks