cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WPB
Kudo Kingpin
Kudo Kingpin

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

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
LanceDelano
Power Apps
Power Apps

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. 

@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!

@lesaltzm   Thoughts?

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)

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

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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 (4,138)