Reputation: 3517
In the OnReconcileError
event for a ClientDataSet, you can tell it to raMerge
, which saves the changes to the delta, ready for another apply updates without errors. Is there a way to tell the dataset to immediately apply the delta in the OnReconcileError
event? I can only think of some convoluted way to check if errors were reconciled in the AfterApplyUpdates
event.
Upvotes: 1
Views: 897
Reputation: 3517
So I did have centralized code for applying the updates, and i eventually realized that would probably be the best place to check if the user requested a merge. I may still need to clean this up a bit, but might be a solution for others running into this problem.
if(cds.ChangeCount > 0)then
begin
fIsMerged := false;
errors := cds.ApplyUpdates(0);
if(errors = 0)then
begin
cds.Refresh;
end
//If there is a conflict, the user might try to merge.
//If they do, we need to reapply the update.
else if(fIsMerged)then
begin
errors := cds.ApplyUpdates(0);
if(errors = 0)then
begin
cds.Refresh;
end;
end;
end;
fIsMerged
is a class variable that I set in the on reconciled handler.
Action := HandleReconcileError(DataSet, UpdateKind, E);
if(Action = raMerge)then
begin
fIsMerged := true;
end;
Upvotes: 1