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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,364)