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 / Highlight duplicates o...
Power Apps
Answered

Highlight duplicates of items of the filtered gallery

(1) ShareShare
ReportReport
Posted on by 102

Hi I have following collection.

LineClassItemCodeItemNameDescriptionSizeSize2
Class11111Pipeaaaa12
Class12222Elbowbbbb11
Class11112Pipeaaab13
Class11111Pipeaaaa23
Class21111Pipeaaaa13
Class23333Flangecccc23

 

The gallery on review/edit screen has filters on LineClass and ItemName.

LineClassItemCodeItemNameDescriptionSizeSize2
Class11111Pipeaaaa12
Class11111Pipeaaaa23
Class11112Pipeaaab13

 

Is there a way to highlight duplicates within the filtered gallery?

I was thinking to highlight duplicates to help reviewer focus on them. for example, in gallery above, it can be combined in one row.

I found solution to highlight duplicates, but it did on entire collection - in case it is not important, same item can be in different classes.

 

Thanks!

 

Categories:
  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    1. Create a Collection to Hold the Filtered Items:
    First, filter the collection based on the LineClass and ItemName you want to display in the gallery. Then, create a new collection containing this filtered data, including a column to determine if an item is a duplicate.

     

    ClearCollect(colFilteredItems,
     AddColumns(
     Filter(YourCollection, LineClass="Class1", ItemName="Pipe"),
     "IsDuplicate", false
     )
    )
    

     

    2. Identify Duplicates and Store in a Separate Collection:
    Use the With scope to create an alias for the filtered collection. Then, use ForAll to go through this alias, storing the duplicates in a new collection called colItemsToPatchAsDuplicate. Use If to include the record if it's a duplicate, and Blank() otherwise.

     

    With({wColFilteredItems: colFilteredItems},
     ClearCollect(colItemsToPatchAsDuplicate,
     ForAll(wColFilteredItems,
     If(
     CountRows(
     Filter(colFilteredItems,
     ItemCode=wColFilteredItems[@ItemCode],
     Description=wColFilteredItems[@Description],
     Size=wColFilteredItems[@Size],
     Size2=wColFilteredItems[@Size2]
     )
     ) > 1,
     ThisRecord,
     Blank()
     )
     )
     )
    )
    

     

    3. Remove Blank Records from the Collection:
    Remove the Blank() records from the collection using ClearCollect again and filtering out the blank items.

     

    ClearCollect(colItemsToPatchAsDuplicate, Filter(colItemsToPatchAsDuplicate, !IsBlank(ThisRecord)))
    

     

    4. Update the Filtered Collection with the Duplicate Markers:
    Patch the colFilteredItems collection by going through colItemsToPatchAsDuplicate.

     

    Patch(colFilteredItems, colItemsToPatchAsDuplicate, ForAll(colItemsToPatchAsDuplicate, {IsDuplicate: true}))
    

     

    5. Create the Gallery and Apply Conditional Formatting:
    Use the colFilteredItems collection as the source for your gallery, and apply conditional formatting to highlight duplicates.

    For example, use a label to display the ItemName, and set its Fill property to change the background color if the item is a duplicate:

     

    If(ThisItem.IsDuplicate, RGBA(255, 0, 0, 0.2), RGBA(255, 255, 255, 0))
    

     

    This formula should apply a light red background to any duplicates in the filtered gallery, helping the reviewer focus on those specific items.

     

    Remember to replace YourCollection with the actual name of your collection, and adjust the filter conditions and fields as per your requirements.

     

    See if it helps @Dulat 

  • Dulat Profile Picture
    102 on at

    @poweractivate 

    Thanks a lot!

    If you haven't provided very clear instructions, I would never figure out 🙂

  • Dulat Profile Picture
    102 on at

    Hi @poweractivate 

     

    I have increased input data in my app - I was pulling about 10K rows to main collection on start.

    Today I have changed source, with 25K rows with exact same columns.

    Once I have increased input data, code gives an error on step 4, I struggling to figure out why.

    Can you advise if you have any ideas?

    Dulat_1-1692035291560.png

     

    Thanks in advance!

     

    Dulat_0-1692034989831.png

     

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard