Appearance
Dataset.FieldByName
Dataset[.Query].Fields.FieldByName
Declaration
function FieldByName( const FieldName : string) : TField
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := DATAVIEW.Query.Fields.FieldByName('field1').AsString; //returns the field called field1.
end;Description
Returns the field object for the named field. The field name is entered as text and is not case sensitive.
This is often written in shorthand form as DATAVIEW['field1'].Value, or DATAVIEW['field1'].AsString, etc. When using the FieldByName function with a Source or Destination Dataview, .Query must be included as shown in the example above. When using the function with a script dataset (including the global datasets Data1, Data2, etc), .Query is not included.
TIP
Shorthand is the most common method for accessing fields. When using shorthand you use square brackets rather than parentheses.