Announcements
Can we add patch function on view in power apps? Since view doesn't have primary key, patch function can't be applied when a view is used as a data source. So is there any work around for this scenario?
Hi @Simran1607 ,
There is a workaround indeed. Update your view to include the primary key for the table(s) you want to patch and slightly amend you patch so it looks similar to the below:
Patch(dataSource, LookUp(dataSource, ID = ThisItem.IDFK), { Column1: patchValue } )
The lookup returns a record which can be used in the patch. This above example is for a gallery but if you're using something else then just set the ID value to a variable and use that in the lookup.
Thanks @MaximusDecimus for the suggestion. Can you kindly also mention which is the column that must be created as unique column in the view table? Is it "IDFK" or "Column1"?
You can call the column whatever you like, ideally whatever makes sense to you. I typically call mine IDFK or something more descriptive if I have multiple tables I want to update from the view.
So what is Column1 in this formula?
That just refers to the column you want to update.
Okay, thank you @MaximusDecimus
I am still getting the error "The data source is either read-only or has no primary key, so the function Patch can't write to it.". P.S. I have all the access to the data source
You'll need to set a primary key in the data source you want to patch to.
UpdateIf(colData, true, {Column1:patchValue});
Patch(view dataSource, colData);
What if I want to use this specific formula for my view, how can I do the key mapping in this formula?
You'd need to ensure that colData is the same format as your destination table.
This is a good read on patching updates and has great examples.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 354 Super User 2026 Season 2
M Bilal Khan 330
Mohsin Ali 232