TxDataWebDataset / ID AutoInc

You can use the following code in AfterApplyUpdates event handler to update the ids of returned objects:

procedure TForm1.XDataWebDataset1AfterApplyUpdates(Sender: TDataSet; Info: TResolveResults);
var
  I: integer;
  BM: TBookmark;
begin
  BM := XDataWebDataset1.GetBookmark;
  try
    for I := 0 to Length(Info.Records) do
    begin
      XDataWebDataset1.GotoBookmark(Info.Records[I].BookMark);
      TJSObject(XDataWebDataset1.CurrentData)['Id'] := TJSObject(Info.Records[I].Data)['Id'];
    end;
  finally
    XDataWebDataset1.GotoBookmark(BM);
  end;
end;
1 Like