Data.DB.TObjectField.FieldValues

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type: property
Visibility: public
Source:
Data.DB.pas
Data.DB.hpp
Unit: Data.DB
Parent: TObjectField

Delphi

property FieldValues[Index: Integer]: Variant read GetFieldValue

C++

__property System::Variant FieldValues[int Index] = {read=GetFieldValue, write=SetFieldValue/*, default*/};

Description

Provides access to the values for all child fields in the object field.

Use FieldValues to get or set the values of the object field's subfields. FieldValues accepts and returns a Variant, so it can handle and convert fields of any type. For example, the following statements are syntactically identical and write the value from an edit box into an ADT field with a child string field called STREET:



DataSet1.FieldByName('ADDRESS.STREET').Value := Edit1.Text;
TADTField(DataSet1.FieldByName('ADDRESS')).FieldValues[0] := Edit1.Text;



Table1->FieldByName("ADDRESS.STREET")->Value = Edit1->Text;
((TADTField*)Table1->FieldByName("ADDRESS"))->FieldValues[0] = Edit1->Text;



The next statements read a string value from the first child field of the object field ADDRESS into an edit box:



Edit1.Text := DataSet1.FieldByName('ADDRESS').FieldValues[0];



Edit1->Text = ((TADTField*)DataSet1->FieldByName("ADDRESS"))->FieldValues[0];



Note: Because FieldValues always uses Variants, it may be slower than directly accessing a subfield and using its native format (i.e., using its AsXXX property), especially in applications that process large amounts of data.

See Also