Hey Guys, Im having issues when I'm trying to update a record in a local collection 'MileageCache' using the patch function. The strange thing is the code works fine updating the sharepoint list directly.
I am wanting to update a local collection of the sharepoint list so adding records works fine when offline.
Here is the code im using, like I say it works fine with the online sharepoint list directly:
UpdateContext(
{
tempMileageItem: First(
Filter(
MileageCache,
ID = MileageItem.ID
)
)
}
);
Patch(
MileageCache,
tempMileageItem,
Patch(
tempMileageItem,
{
'End Mileage': Value(MileageText.Text),
'End Date': Now(),
'End Location': Location.Latitude & "," & Location.Longitude
}
)
)The global variable MileageItem is a single record from MileageCache and is set by:
Set(
MileageItem,
Patch(
MileageCache,
Defaults(MileageCache),
{
'ID':100,
'Start Mileage': Value(MileageText.Text),
'Start Date': Now(),
'Start Location': Location.Latitude & "," & Location.Longitude
}
)
)Does anyone have any ideas why I am unable to update the record in the collection using the Patch function ?