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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Duplicates in Text Inp...
Power Apps
Answered

Duplicates in Text Input Across Gallery - How to Identify Them?

(0) ShareShare
ReportReport
Posted on by 22

I have a gallery fed by a Sharepoint list allowing users to enter a MAC Address, Serial Number, etc into Power Apps.  I am trying to find a way to identify which text inputs are a duplicate from other text inputs.  My use case is we have users duplicating MAC Addresses across the screen and I need a way to identify it.

 

Any thoughts on how to accomplish this?

 

CraigLee23_0-1660782258109.png

 

Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    It's really easy.    It all depends on what you want to do.  If you want to highlight (set the fill) the control or change the border color for the duplicates, you would simply set a formula like this one:

     

     

     

    If(ThisItem.columnname in Datasource.columnName, Red, Black)

     

     

     

    If you want to have a popup message of some sort when a user enters a duplicate mac address, you would set the OnChange value of one of the text inputs to something like this and then use your variable to control the visibility of the controls you are using for your 'popup' message.

     

     

     

    If(Self.Text in PowerAppsData.Title, Set(varDuplicate, true))

     

     

     

  • CraigLee23 Profile Picture
    22 on at

    Thanks for the help!  I am trying to figure this out with a Text Input in the gallery matches any other Text Input across the Gallery.  So my 'data source' is the inputs that the user has entered so far.  

     

    I'll do another check against the DB, but I get that part.  My concern is the onscreen stuff that has been entered.

     

    I'm thinking I may need to Collect each MAC value when 'OnChange', then match against it in a collection....make sense?

  • Ricardo_Costa Profile Picture
    150 on at

    I assumed the 'OnChange' is a textbox property, so, you don't need to collect since you already have all MACs.

    in the OnChange, you can just test like this

    If(IsBlank(LookUp(MyDataSource,MAC = txbMAC.Text)),"","MAC already registered")

  • Verified answer
    CraigLee23 Profile Picture
    22 on at

    I solved this - each of your tips above helped my writers block and I have a solution....using a collection.

     

    Screen - OnVisible:

     

    ClearCollect(colDup, {MAC:"X", Solution:"X", Item:"X"});

     

    Within the Gallery, each solution item can have up to 10 MAC Addresses, so I have a text input (MacInput_1 thru _10).  Here is the MacInput_1.OnChange:

     

    If(IsBlankOrError(LookUp(colDup, Solution = ThisItem.ProductCode && Item = "Mac1")),
    Collect(colDup, {MAC:Self.Text, Solution:ThisItem.ProductCode, Item:"Mac1"}),
    UpdateIf(colDup, Solution = ThisItem.ProductCode && Item = "Mac1", {MAC:Self.Text}))

     

    I made the same change for _2 thru _10.

     

    Then I updated MacInpupt_1.Fill:

     

    If(CountRows(Filter(colDup, MAC = Self.Text))>1, Red, White)

     

    I made the same change for _2 thru _10.

     

    This is working as I intended.

     

    CraigLee23_0-1660853846931.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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard