cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WPB
Level 8

Patch is not working

 

 image.png

 

 

It's a SQL table. I'm using tables from this same Azure DB and everything is fine. Somehow, trying to create a new patch isn't working at all. Tried everything. I can read the data in a Gallery, the Identity Specification is set to auto-generate and all the other values are set to allow nulls... What am i doing wrong?

 

The button code:  

 

Patch('[dbo].[Discussion_Exchanges]',Defaults('[dbo].[Discussion_Exchanges]'),{Type:0,data:TextInput1.Text});
Refresh('[dbo].[Discussion_Exchanges]')

 

 image.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff lesaltzm
Power Apps Staff

Re: Patch is not working

Hi @WPB,

 

This error message occurs when the data source is registered as a read-only data source. It's an outdated error message, and we'll be updating it soon. Could you verify that the data source is writable, and has a primary key? If it is, feel free to email me at REMOVED, and we can work through this issue together.

 

McCall

View solution in original post

6 REPLIES 6
Power Apps Staff LanceDelano
Power Apps Staff

Re: Patch is not working

The first argument of Patch must be a collection.   A common reason for this error is because the back-end data source is a table but there is no primary key or is read-only. 

 

How to fix:

 

  1. Ensure that the input to the Patch function is a collection.
  2. Ensure that the back-end data source table is writable and has a primary key.

 

Let us know if this helps. 

WPB
Level 8

Re: Patch is not working

@LanceDelano 

Thanks for the help!

I tried :

DataSourceInfo('[dbo].[Discussion_Exchanges]',DataSourceInfo.CreatePermission)

DataSourceInfo('[dbo].[Discussion_Exchanges]',DataSourceInfo.EditPermission)

DataSourceInfo('[dbo].[Discussion_Exchanges]',DataSourceInfo.ReadPermission)

 

All true.

image.png

 

 

The image is from SSMS. It shows the values in the table. I can access them using:

First('[dbo].[Discussion_Exchanges]').Data                       ->    "Salut!"

LookUp('[dbo].[Discussion_Exchanges]',ID=1).Data         ->    "Salut!"

First(Filter('[dbo].[Discussion_Exchanges]',ID=1)).Data     ->    "Salut!"

 

This proves that the data is a collection.

 

At this point:

Appid : 7c104dad-6476-45f8-b7cf-feaa78725aab

 

Once again, your time is really appreciated!

Power Apps Staff LanceDelano
Power Apps Staff

Re: Patch is not working

@lesaltzm   Thoughts?

WPB
Level 8

Re: Patch is not working

I really need help with that. I've been working a lot with PowerApps but this is impossible to work around...

Is there a way I could get live support? (No idea if it's included in the Office 365 subscription or not, but I'm willing to pay)

Power Apps Staff lesaltzm
Power Apps Staff

Re: Patch is not working

Hi @WPB,

 

This error message occurs when the data source is registered as a read-only data source. It's an outdated error message, and we'll be updating it soon. Could you verify that the data source is writable, and has a primary key? If it is, feel free to email me at REMOVED, and we can work through this issue together.

 

McCall

View solution in original post

Highlighted
WPB
Level 8

Re: Patch is not working

I feel really bad about myself right now... two days of looking around for something so basic...

The error was that I had an auto-incrementing column in my SQL DB that i didn't declare to be primary...

Thanks a lot for the help and sorry for the troubles.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,042)