DB.TObjectField.FieldValues
From RAD Studio VCL Reference
Contents |
Delphi Information
From DB.pas
property FieldValues: Variant read GetFieldValue write SetFieldValue;
Unit: DB
Type: property
Visibility: public
Member Of: TObjectField
C++ Information
From DB.hpp
__property System::Variant FieldValues = {read=GetFieldValue,write=SetFieldValue};
Unit: DB
Type: property
Visibility: public
Member Of: TObjectField
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.