Highlight Duplicate Records in Canvas PowerApps in Gallery Control - CloudFronts

Highlight Duplicate Records in Canvas PowerApps in Gallery Control

Hi All,

Let’s see how to highlight duplicate records in Gallery control what works on data source or collection.


In this example: I’ll be using a collection that I will highlight in 2 ways

  • Any Records that are duplicate
  • Find selected Items that are duplicate

Use-case: I want to highlight duplicate ‘Project Allocation’ entries submitted. If someone has submitted a entry that has on Same Project twice needs to be highlighted.

Step 1: I created a collection to replicate the scenario

Step 2: Add the formula in ‘Template Fill‘ property in Gallery Control.

If(
   CountRows(
      Filter(colData, Name = ThisItem.Name && Project = ThisItem.Project)
   ) > 1,
   ColorFade(ColorValue("#" & Mid(Rand(), 3, 6)), 60%),
   RGBA(0, 0, 0, 0)
)

Note: I have used random color style in my gallery, so output will be as follows


For highlight only selected items in the gallery, the code will be as follows

If(
    ThisItem.Name = Gallery1.Selected.Name, 
    ColorFade(ColorValue("#" & Mid(Rand(), 3, 6)), 60%), 
    RGBA(0, 0, 0, 0)
)

Therefore, output will be as follows


Hope this helps


Share Story :

Secured By miniOrange