FieldCount
property FieldCount: Integer read;
Example
procedure CountFields(const Data: TvxClientDataSet; var Count: Integer);
begin
Count := Data.FieldCount;
end;
Usage
FieldCount returns the number of currently instantiated field components in the dataset's Fields collection.
- Re-read after open/schema changes.
- Guard zero before calculating
FieldCount - 1. - Do not compare with RecordCount.
Usage guidance
- Re-read after open/schema changes.
- Guard zero before calculating
FieldCount - 1. - Do not compare with RecordCount.
- Field order can be significant to AppendRecord/InsertRecord and must be governed before positional writes.
Additional Technical Info
FieldCount is declared by hidden ancestor TDataSet and is normally used through a visible descendant such as TvxClientDataSet. It counts fields, not records, field definitions or non-null values.
Source-backed behaviour
The compiled getter returns FFields.Count. Dynamic fields are normally created/opened with the dataset and can be destroyed/recreated on lifecycle/schema changes; persistent fields can have a different lifecycle. Valid Fields collection indexes are 0..FieldCount-1.
Aggregate fields live in a separate collection even though FindField can search them, so this count is not a guarantee that every name resolvable by FindField appears here.
Related members
Fields returns the collection. GetFieldNames exports names and RecordCount counts rows.