Skip to main content

FieldByName

function FieldByName(const FieldName: string): TvxField;

Example

function OrderNumber(const View: TdaSQLQueryDataView): string;
begin
Result := View.FieldByName('OrderNumber').AsString;
end;

Usage

FieldByName returns a client-dataset field by its physical dataset name and raises a database error when that name is absent.

  • Use FieldExists for optional schema.
  • Use this required form when a missing configured field should fail the flow immediately.
  • Never free the returned reference, and reacquire it after fields are rebuilt.

Additional Technical Info

FieldByName performs a required lookup against the concrete client dataset's TFields collection.

Source-backed behaviour

The hidden base returns nil. Both visible descendants call FQuery.Fields.FieldByName(FieldName), which performs the Delphi field-collection lookup and raises EDatabaseError when absent. The return is registered as TvxField, but the object remains the native concrete field created from dataset metadata; the overlay does not change ownership or storage.

This method expects the physical dataset field name (SQLFieldName/generated field name), not necessarily a report/DataPipeline alias. The default Fields property first resolves an alias and then calls this method. Lookup is case-insensitive in the underlying field dictionary, but callers should preserve configured spelling for clarity.

Official terminal references

Created 2026-07-15