Skip to main content

Append

procedure Append;

Example

procedure AddRecord(const Data: TvxClientDataSet);
begin
Data.Append;
try
Data.FieldByName('Code').AsString := 'A100';
Data.Post;
except
Data.Cancel;
raise;
end;
end;

Usage

Call Append on an active, editable dataset when you want to add a new record at the logical end of its current records. Unlike Insert, it does not start the new record at the current cursor position.

Append only opens a pending record for editing. Assign the required field values, then call Post to accept the record or Cancel to abandon it. Wrap assignments in exception handling so a failed assignment cancels the pending record. Posting changes the dataset; it does not by itself save the record to an external database.

Additional Technical Info

Append is declared by hidden ancestor TDataSet and is normally used through a visible descendant such as TvxClientDataSet. It creates an editable record buffer; it does not save that record by itself.

Source-backed behaviour

The compiled modified Data.DB path first runs the common insert checks: any current edit is resolved through browse mode, modify permission and parent/detail state are checked, and before-insert/before-scroll events run. It then clears cursor buffers, initializes a record flagged at EOF, obtains preceding records, invokes descendant InternalInsert, enters dsInsert, invokes the new-record callback and emits insert/scroll notifications.

Defaults and calculated-field callbacks can run before script assignments. The pending row becomes part of the concrete dataset only after Post; Cancel abandons it.

Operational guidance

  • Require Active and a modifiable descendant.
  • Wrap field assignment and Post so an exception explicitly cancels the pending insert.
  • Append is not a database transaction and does not prove any server write.
  • Event, provider, default/calculated-field and allocation errors propagate; cursor state may already have changed.

Insert starts a row near the current position. AppendRecord supplies values and completes the add in one call.

Official RTL references

Created 2026-07-15