RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TObjectField.FieldValues Property

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

Pascal
property FieldValues [Index: Integer]: Variant;
C++
__property Variant FieldValues[int Index];

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 reads 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.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!