cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
johannasouth
Helper III
Helper III

Identifying duplicate when clicking out of a field

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?

12 REPLIES 12
TheRobRush
Super User
Super User

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

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

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
Super User
Super User

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

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

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

 

johannasouth_0-1647020466265.png

johannasouth_1-1647020492631.png

 

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
Super User
Super User

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.

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

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
Super User
Super User

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)

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

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

 

johannasouth_0-1647022670081.png

 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,823)