Appearance
Field
Declaration
DATAVIEW.FieldByName['fieldname'] : TField
DATAVIEW['fieldname'] : TField
Description
The Field object can be used to retrieve data from a field within a Data View.
Normally the .Value property is used to retrieve the value of a field however you can impose some formatting/conversion by using specific properties like .AsString, and .AsFloat (Refer to Referencing Fields for more information)
TIP
Whereas the Value property will retrieve the value as a Variant, the other functions will convert the value to its type. For instance if the field is null then retrieving the value using AsString will result in a blank string being returned instead of a null value.
You can access a field object by referencing it from a Data View object. This is achieved through the FieldByName function however because fields are used so commonly it is normally written in shorthand such as DATAVIEW['FieldName']
Usage
Among other things the following tasks can be achieved by working with the Field object
Set or retrieve the value of the field
You can set or read the value of a field using .Value, .AsString, .AsInteger, and .AsFloat
You can determine the length of the field value
The Length property will return the length of the fields value. This only applies to string fields