I have a datasource '[dbo].[Equipment]' that I want to update records from a collection 'EquipmentToBeChanged'.
I assumed this would be the correct code to do so
Patch('[dbo].[Equipment]',EquipmentToBeChanged);
But I get this error.
Invalid argument type (Table). Expecting a Record value instead.
Patch requires you to pass in the collection you're updating as it traces back to how you got it (query, filter, search, etc), if you're not creating new records. So you'd need something like this, assuming you're trying to update a single device in your datasource:
Patch( '[dbo].[Equipment]', First( Filter( '[dbo].[Equipment]', ColumnToCompare = "ValueToCompare" ) ), { ColumnToUpdate: “Value” } )
Instead of nesting Filter
inside of First
, you can also use LookUp to pull the first matching record, assuming your comparison is precise enough.
https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch