cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewLearner1
Helper I
Helper I

Check duplicate before saving in sharepoint

Hi,

 

I am new to powerapps.I have an App with problem. I don't want users to save duplicate data in sharepoint.

I have to a sharepoint list named as 'SPList' with multiple columns and I want to check duplicates for two columns before saving data in SP.

 

Example :

I have SP with the columns

System Name         System Description

------------------      ------------------------

System ABC             Desc A

System XYZ             Desc X

System PQR            Desc P

....etc have multiple entries

 

When I am adding new entry to Sharepoint it should check for below 

System ABC - Desc X ===> it should accept the entry 

System XYZ - Desc A ===> it should accept the entry

System ABC - Desc A ===>it should give error as duplicate entry

System XYZ - Desc X ===>it should give error as duplicate entry

 

Please suggest. Thanks in advance.

19 REPLIES 19

Hi @eka24 ,

 

Sorry unable to take the screen but pasting the formulas 

 

Onselect property of save button :- 

 

If(IsBlank(LookUp(SPList,'System Name' = DataCardValue1.Selected.'System Name')) && IsBlank(LookUp(SPList,'System Description'=DataCardValue2.Text)),SubmitForm(EditForm1),Notify("Duplicate",NotificationType.Error))

 

for the above formula getting error in the below line

 If(IsBlank(LookUp(SPList,'System Name' = DataCardValue1.Selected.'System Name'))

Errors :

1 error on = sign as 'invalid argument type' and

2 error on 'System Name' as "Name isn't valid.This identifier isn't recognized."

 

Item property of System Name dropdown is Pasting below

Choices([@SPList].SystemName)

 

My form name is EditForm1

 

Please suggest.

Hi @eka24 ,

Sorry unable to take screenshot, but pasting the formulas

 

code of OnSelect property of save button

If(

IsBlank(LookUp(SPList,'System Name'= DataCardValue1.Selected.'System Name')) &&

IsBlank(LookUp(SPList,'System Description' = DataCardValue2.Text)),

SubmitForm(EditForm1),

Notify("Duplicate"))

 

getting two errors on the line 

IsBlank(LookUp(SPList,'System Name'= DataCardValue1.Selected.'System Name'))

1 error on = sign as "invalid argument type"

2 error is on 'System Name' as "Name isn't valid.This identifier isn't recognized."

 

Below is the Item property code of System Name dropdown

Choices([@SPList].SystemName)

 

My form name is EditFom1

 

Please suggest, stucked with this issue.

eka24
Super User
Super User

What is the exact column name 'System Name' or SystemName in your sharepoint list?

If(
IsBlank(LookUp(SPList,'System Name'.Value= DataCardValue1.Selected.SystemName)) &&
IsBlank(LookUp(SPList,'System Description' = DataCardValue2.Text)),
SubmitForm(EditForm1),
Notify("Already Exist"))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24 ,

 

In my sharepoint list column name is 'System Name'

but it the Items property of my 'System Name' dropdown it is showing as 

Choices([@SPList].SystemName)

 

eka24
Super User
Super User

What you tried this;
If(

IsBlank(LookUp(SPList,'System Name'.Value= DataCardValue1.Selected.SystemName)) &&
IsBlank(LookUp(SPList,'System Description' = DataCardValue2.Text)),
SubmitForm(EditForm1),
Notify("Already Exist"))

 

Am really surprised how the name in dropdown is different from the sharepoint list. Are you using a collection on the dropdown or directly connected. That is the main reason i asked for the screenshot

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi,

Even I don't know why it is different, but when I checked in the advanced tab of datacard it is showing 

DisplayName as "System Name" and DataField as "SystemName".

 

I have tried this formula :

If(
IsBlank(LookUp(SPList,SystemName.Value= DataCardValue1.Selected.Value)) &&
IsBlank(LookUp(SPList,'System Description' = DataCardValue2.Text)),
SubmitForm(EditForm1),
Notify("Already Exist"))

 

It is giving me the output as below

 

System NameSystem DescriptionExpected ResultActual Result 
System ABCDesc AAcceptAccepted 
System ABCDesc BAcceptduplicate errorit should accept this entry
System ABCDesc A or Desc BError  
System XYZDesc AAcceptAccepted 
System XYZDesc B or any new entryAcceptduplicate errorit should accept this entry
System XYZDesc A or Desc BError  

 

please advice me, not getting what is wrong.

NewLearner1
Helper I
Helper I

Can anyone please help me to resolve this issue?

 

eka24
Super User
Super User

The DataField name should be used. In other case because am not clear and you are also not sure of the names, i can only proceed if you show screen shot (it could be sent using the private mail)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24 ,

 

Attaching the screenshot.

Field name in my app has renamed

System Name should be considered as Application Name

System Description should be considered as Requirement Description.

 

Please check and help me

 

@NewLearner1 ,

What are the Items of DataCardValue1?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,829)