cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AntonioHAC
Level: Powered On

Check in SP before saving.

I have an APP with a problem. My users are saving duplicate data. I need to let you know if anything is already saved.
I thought of something like this, but isn't working.

 

 

If(
Patch(DataTurno_v1,
     {IsEmpty(MyTurno.Selected.Value)}),
UpdateContext({pop1:true}))

 

2 REPLIES 2
Highlighted
Microsoft Employee

Re: Check in SP before saving.

Hello AntonioHAC,

 

I don't think you can use the Patch function that way. Please see this: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Are you trying to prevent duplicates in a certain field in SP? If so then the best way would be to mark the corresponding field as "unique". In this case you could use a regular form submit functionality and it will show user a warning on an attempt to store duplicate values.

If the duplicates criteria is more complex then one way would be to use the LookUp function to see if the records exists and then call SubmitForm or Patch. For example, your Submit Button.OnSelect could be set to something like:

f(LookUp(DataTurno_v1, Condition_To_Check_For_Dupplicates, "found") <> "found", SubmitForm(Form1), UpdateContext({ppp1: true}))

Condition_To_Check_For_Dupplicates would be comparing the value from thr data card from your form with the value from the SP field. For example, if the your data card value is DataCardValue10 and the SP field name is MyTurno then the condition would be DataCard.Text=MyTurno

Community Support Team
Community Support Team

Re: Check in SP before saving.

Hi @AntonioHAC,

 

Could you please share a bit more about your PowerApps app?

 

I agree with @dinusc's thought almost, I assume that you have a unique column (which could identify one record uniquely) in your SharePoint list, you could also take a try with the following workaround:27.JPG

Within EditScreen, the OnSelect property of the Submit button set to following formula:

If(IsEmpty(LookUp('20180521_case11',ProductName=DataCardValue10.Text)),SubmitForm(EditForm1),UpdateContext({pop1: true}))

Note: The '20180521_case11' represents the SharePoint list data source in my PowerApps app. The ProductName is a column in my SharePoint list, which has enabled "Enforce Unqiue Values" option. The DataCardValue10.Text is used to reference the value of the ProductName property within EditForm control.

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 44 members 3,902 guests
Please welcome our newest community members: