Last
procedure Last;
Example
procedure MoveToLast(const Data: TvxClientDataSet);
begin
Data.Last;
end;
Usage
Moves to the last available record after enforcing bidirectional navigation and resolving pending edits.
- Do not call only to calculate a count unless full-fetch cost is intended.
- Explicitly resolve edits when implicit Post/Cancel is unacceptable.
- Unidirectional datasets raise.
Additional Technical Info
Last is declared by hidden ancestor TDataSet and is normally used through a visible descendant such as TvxClientDataSet. On fetch-on-demand descendants it can force retrieval of all remaining rows.
Source-backed behaviour
The compiled base calls CheckBiDirectional, CheckBrowseMode, before-scroll, clears buffers, invokes descendant InternalLast, loads prior records, then sets EOF true, emits dataset-change and runs after-scroll. TCustomClientDataSet.InternalLast calls CheckProviderEOF before moving its DS cursor to EOF.
TvxClientDataSet configures FetchOnDemand=False and PacketRecords=-1, so its normal open already requests the full result. Other descendants can perform expensive remote fetch during Last.
Related members
First moves to the first record. RecordCount can become complete only after full fetch in generic datasets.