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 / Identifying duplicate ...
Power Apps
Unanswered

Identifying duplicate when clicking out of a field

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a SharePoint list (List 1) that I've created a power app form for.  I have a field called App ID that is a lookup field to a data source.  What I'm attempting to do is say, if you select an App Id on my form, and there is already a row in my list with that App ID, give the user a message like, "This App ID already has a row created.  Please update the existing row for your App ID.".  

 

I'd like to no have them go through the whole form, and submit, before finding out its already in there.  

 

Any ideas on this?

Categories:
  • TheRobRush Profile Picture
    11,128 Moderator on at

    onchange of that field (assuming its text input or something?) throw out a lookup formula that returns a notify

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Looking for more specific help.  I understand the notify but not the lookup part.  Can you help me write what I need to put in onchange?  The field is called datacardvalue2

  • TheRobRush Profile Picture
    11,128 Moderator on at

    this will only trigger after they have clicked out of the area they are typing and selected something else in the app if placed in onchange

    ///List 1 is list name
    /// title is column name in list
    ///datacardvalue2.text is where they typed
    
    If(CountRows(Filter('List 1',Title=datacardvalue2.Text))>0,Notify( "This APP ID has already been added", NotificationType.Error ))

    alternatively you can place it in a timer with an timer.

    set the on timer end to

    If(CountRows(Filter(InProgressTrainingClass,Title=TextInput5.Text))>0,Notify( "Duplicate Entry", NotificationType.Error );Set(repeatVar,false),Set(repeatVar,true))

    auto pause and auto start on and repeat set to

    repeatVar

    and also place

    Set(repeatVar,true)

    in onselect and onchange of textbox in this version.

     

    That will have it pop up even before they move out of the box

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Getting closer!  I put this in my onchange but getting the below error.  

     

    johannasouth_0-1647020466265.png

    johannasouth_1-1647020492631.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It also didn't like the .Text so I chose .SearchText but still got the above error.  Thanks for the help, it gets confusing for a novice! 

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Delegation warnings are not errors, they are just warnings. CountRows does not work once a splist has more than 2000 items on it due to delegation. It will only ever show you that warning in the App Editor, not on device where app is running. If you would have more than 2000 items on your list then you would need to come up with a seperate delegable method.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Gotcha - that shouldn't be an issue.  

     

    However, this still isn't showing an error when I move out of the field, after choosing a duplicate value. 

     

    I mentioned I had to change .Text to .SelectedText to fix an error.  But still, no luck.

     

    johannasouth_0-1647021066534.png

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    did you create the timer control I suggested? The timer is a much more reliable way to get the error to show up. (If you wanna test your code to make sure it works throw it onto the onselect of a button, and then you can make sure there are no errors in what you have coded)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I tried that too.  If I understood correctly, I put this in the on change box:

     

    johannasouth_0-1647022670081.png

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    break it down step by step. put a label in there and set it to your CountRows(), see what that is returning.

    If it is returning a number greater than 0, take your entire code portin in post above and put it on a button's onselect, and manually press it to see if it is popping up your error notification. If it is then we will need to look at the ontimerend and repeat sections of your timer (also make sure the timer length is somethign like 100 not 6000) to ensure timer is running correctly

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard