@kund14
Based on your description, it seems like you're trying to use Patch function to update a local collection (colDevices), but you're getting the "The data source supplied to the function is invalid" error.
This could be because Patch function is mainly used to modify specific records in a data source. In your case, you're trying to modify a record in a local collection, which might not be a valid use of Patch.
Instead, you should use Collect or UpdateIf for adding/updating data in a local collection. For example, you could use:
Collect(
colDevices,
{
Device: drpDevice.Selected.Value,
Status: drpDeviceStatus.Selected.Value,
Operator:If(!IsEmpty(cmbOperator.Selected.Mail),cmbOperator.Selected.Mail,""),
Location:txtLocation.Text,
Description:txtDescription.Text
}
)
This Collect function will add a new record to the colDevices collection each time the save button is clicked.
However, if you want to update a specific record in the colDevices collection instead of always adding a new record, you could use UpdateIf function:
UpdateIf(
colDevices,
ThisItem,
{
Device: drpDevice.Selected.Value,
Status: drpDeviceStatus.Selected.Value,
Operator:If(!IsEmpty(cmbOperator.Selected.Mail),cmbOperator.Selected.Mail,""),
Location:txtLocation.Text,
Description:txtDescription.Text
}
)
This UpdateIf function should update the current record (ThisItem) in the colDevices collection with the new values when the save button is clicked.
You should try and replace Patch function with either Collect or UpdateIf depending on whether you want to always add a new record or update the existing record.
If I understood correctly I believe Patch function is for updating data in a data source (like a table in a database), and not for a local collection in PowerApps.
See if it helps @kund14