@wp
If you will be checking the map database fields you may notice that in my original example in the case of tasks and contacts the resourceid and recordid were switched.
However after correcting these there still are problems with contacts and tasks.
I have looked into tasks and I believe the issue when updating a task may be that the wrong fields are being updated.
Haven't had time to look into this properly, but my observations to vpflxds.pas were the following:
1) the post actions (which should update the database) are different.
eg. compare
procedure TVpFlexDataStore.PostEvents;
with
procedure TVpFlexDataStore.PostTasks;
PostEvents has the following code
...
{if no events dataset has been defined then bail.}
if (FEventsDataSrc = nil)
or (FEventsDataSrc.DataSet = nil) then
Exit;
if (Resource <> nil) and Resource.EventsDirty then begin
{ Dump this resource's dirty events to the DB }
if (FResourceDataSrc <> nil)
and (FResourceDataSrc.DataSet <> nil) then begin
FResourceDataSrc.DataSet.Open;
FN := GetFieldName(FEventMappings, 'ResourceID');
if (FN <> '')
and FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, [])
then begin
...
PostTasks
...
if (Resource <> nil) and Resource.TasksDirty then begin
if (FResourceDataSrc <> nil)
and (FResourceDataSrc.Dataset <> nil) then begin
FResourceDataSrc.DataSet.Open;
if FResourceDataSrc.DataSet.Active then begin
FN := GetFieldName(FTaskMappings, 'ResourceID');
{ Dump this resource's dirty contacts to the DB }
if not FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, [])
then Exit;
end; {if FResourceDataSrc.DataSet.Active}
end; {if (FResourceDataSrc ...}
{filter tasks}
...
The different code is meant to do the same purpose, however note that for tasks the procedure doesn't trap for a failure to link a 'ResourceID' unlike PostEvents (all it needed was a (FN <> '').
My other issue with this code is whether
FN := GetFieldName(FTaskMappings, 'ResourceID');
FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, [])
Are correct:
They are looking for the [ResourceID] as found in the ResourceTable but with the name used in the TasksTable.
I am not sure whether this should be:
FN := GetFieldName(FResourceMappings, 'ResourceID');
OR
whether you first want to locate the ResourceID in the tasksTable, verify that it exists in the ResourceTable table and then proceed....