cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pwrappr01
Helper V
Helper V

How can I filter one collection of SharePoint items to show items NOT in another collection of SharePoint items?

I have two collections containing SharePoint list data. I want to show items in a gallery from Collection A that do NOT exist in Collection B, and I want to do this by comparing emails from a SharePoint Person column.
Here's the example:

Collection A:

Person
Table
Table

Collection B:

DatePerson
7/2/2020Table
7/2/2020Table

Since the "tables" are from SharePoint, this is a sample of what they contain:

DisplayNameEmail
Joe Smithjsmith@email.com

I figured I'd do something like this in the Gallery's Items property, but this obviously doesn't work:

Filter(CollectionB,Not(CollectionB.Person.Email in CollectionA.Person.Email))
1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @pwrappr01 :

Please check the following two situations:

Case1:If the person fileds in collectionA and collectionB are all table type,Please try this code:

 

Filter(CollectionB,!(First(Person).Email in Ungroup(CollectionA,"Person").Email))

 

Case2:If the person fileds in collectionA is  table type but the person fileds in collectionB is  record type ,Please try this code:

 

Filter(CollectionB,!(Person.Email in Ungroup(CollectionA,"Person").Email))

 

Best Regards,

Bof

 

View solution in original post

4 REPLIES 4
mdevaney
Super User III
Super User III

@pwrappr01 
Your formula is very close to the solution.  Here's how I would write it 🙂

Filter(CollectionA, !(Person.Email in CollectionB.Person.Email))



---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney, thanks for the response. I tried this, but the CollectionB.Person.Email throws an error ("Name isn't recognized") when used in conjunction with the in operator for some reason. It works everywhere else in the app when invoked.

v-bofeng-msft
Community Support
Community Support

Hi @pwrappr01 :

Please check the following two situations:

Case1:If the person fileds in collectionA and collectionB are all table type,Please try this code:

 

Filter(CollectionB,!(First(Person).Email in Ungroup(CollectionA,"Person").Email))

 

Case2:If the person fileds in collectionA is  table type but the person fileds in collectionB is  record type ,Please try this code:

 

Filter(CollectionB,!(Person.Email in Ungroup(CollectionA,"Person").Email))

 

Best Regards,

Bof

 

View solution in original post

@v-bofeng-msft, Case #2 worked like a charm. Thank you much, and thank you, @mdevaney, for posting to assist.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (80,469)