cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
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

Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,397)