web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Comparing Galleries an...
Power Apps
Answered

Comparing Galleries and removing duplicates

(0) ShareShare
ReportReport
Posted on by 15

I have two galleries connected to two dataverse tables. Gallery1 has items that get patched into Gallery2 and that works just fine. When I try to filter out Gallery2 items from Gallery 1 to prevent duplicate additions, I found that this code: Filter('Datatable', Name <> Gallery3.Selected.Name) works to remove whatever is selected in Gallery2, but won't work when looking at AllItems. Error says it can't compare text to a record but whenever I try to tweak the formula it breaks further. Any helps is greatly appreciated!

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @BryantY 

    Please consider changing your Formula to the following:

    Filter('Datatable', Name <> Gallery3.AllItems.Name)

     

    Now, that said..you mentioned Gallery1 and Gallery2 in your post, but only Gallery3 is seen in your formula.

     

    Hopefully this will provide enough to get you going, but if not, please describe more of the scenario. 

  • BryantY Profile Picture
    15 on at

    @RandyHayes 

    The two galleries I'm using are named Gallery2 and Gallery3 the first gallery being on a different page with a different function. "Name <> Gallery3.AllItems.Name" gives the error "Incompatible types for comparison. These types can't be compared: Text, Table". The name column for Gallery3 is a lookup column from when we initially set it all up. Would that be what's causing the hiccup?

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @BryantY 

    Oops...sorry I forgot to change the most important part from your formula (I got so focused on where is this Gallery3 coming from!!).

     

    The formula should be:

    Filter('Datatable', !(Name in Gallery3.AllItems.Name))
  • BryantY Profile Picture
    15 on at

    @RandyHayes I ended up changing the lookup column to a text column since it was getting its value from the patch and applied your formula above. It fixes the errors, but it doesn't show any data in Gallery2. Any thoughts?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @BryantY 

    I'm a little confused on all the galleries.

    Can you provide the Items properties for each one?

  • BryantY Profile Picture
    15 on at

    @RandyHayes Gallery2 holds line items used to create a contract set up. each row has an "add" button that patches it into Gallery3 and associates that line item with that company. Once that item is added though we're trying to take it out of Gallery2 so the likelihood of duplicates is null. It was able to remove one row being the selected row at the beginning of this. My goal was to filter the data going into Gallery2 so as Gallery3 filled up the options used would be taken out.

    Gallery2: Filter('Datatable1',  !(Name in Gallery3.AllItems.'Item Name'))

    Gallery3: Filter('Datatable2', Contract.Name = Text(DataCardValue37))

  • BryantY Profile Picture
    15 on at

    @RandyHayes 

    I was able to get the function working! Your solution worked for filtering the gallery contents, but the app wasn't able to compare the two so I added a collection for the actual comparison and it's doing its job! Thank you so much!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard