cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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 dinusc
Microsoft

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 @Anonymous,

 

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
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,029)