TDAFieldCollection

Overview

TDAFieldCollection is a container for TDAField objects that represent the physical fields underlying a dataset or calculated fields.

This class is used:

  1. In Data Tables as a fields storage. When you create a data table via TDARemoteDataAdapter or TDALocalDataAdapter components, all fields automatically append from the Schema. If you want to receive all fields again, you can use the menu command "Retrieve DataTable Schema" on the data table component.

  2. In IDAConnection methods to receive fields information. Methods:

  3. GetTableFields

  4. GetQueryFields

  5. In the TDAWhere class as a fields storage.

Location


 

constructor Create (TPersistent)

Creates a new instance.

constructor Create(aOwner: TPersistent)

Parameters:

  • aOwner: owner

constructor Create (TPersistent, TDAFieldClass)    (declared in TDACustomFieldCollection)

Creates a new instance.

constructor Create(aOwner: TPersistent; aFieldClass: TDAFieldClass)

Parameters:

  • aOwner: owner
  • aFieldClass: field class

constructor Create (TPersistent, TCollectionItemClass)    (declared in TSearcheableCollectionCached)

Initializes the collection with the supplied parameters.

constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass)

Parameters:

  • AOwner: owner
  • ItemClass: item class

Add  reintroduce overload    (declared in TDACustomFieldCollection)

Creates new TDAField and add it to collection

function Add: TDAField

Add (string, TDADataType, Integer): TDACustomField  overload    (declared in TDACustomFieldCollection)

Creates new TDAField, fills with specified properties and adds it to collection

function Add(const aName: string; aType: TDADataType; aSize: Integer): TDACustomField

Parameters:

  • aName: field name
  • aType: field type
  • aSize: field size

Assign  override    (declared in TDACustomFieldCollection)

Calls AssignFieldCollection if source is TDACustomFieldCollection

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

AssignFieldCollection    (declared in TDACustomFieldCollection)

Copies the contents of another collection to the object where the method is executed.

procedure AssignFieldCollection(Source: TDACustomFieldCollection)

Parameters:

  • Source: Instance whose properties will be copied

Bind (TDataset)  overload    (declared in TDACustomFieldCollection)

Binds child fields with aDataset

procedure Bind(aDataset: TDataset)

Parameters:

  • aDataset: dataset

Bind (IDASQLCommandNativeObject)  overload    (declared in TDACustomFieldCollection)

Binds child fields with aNativeObject

procedure Bind(aNativeObject: IDASQLCommandNativeObject)

Parameters:

  • aNativeObject: native object

CloneItem    (declared in TSearcheableCollection)

Inserts a copy of an item and names it "Copy nn of " of the cloned item name.

function CloneItem(iIndex: Integer): Integer

Parameters:

  • iIndex: position.

DataDictionary    (declared in TDACustomFieldCollection)

Gets/sets the DataDictionary property.

property DataDictionary: IDADataDictionary read write

FieldByName (string): TDACustomField    (declared in TDACustomFieldCollection)

Finds a field based on its name. If the specified field does not exist, FieldByName raises an exception.

function FieldByName(const aName: string): TDACustomField

Parameters:

  • aName: name of the searched field

FieldByName (string): TDAField  reintroduce

Returns an item with the specified name. If no matching field is defined, an exception will be raised.

function FieldByName(const aName: string): TDAField

Parameters:

  • aName:

FieldEventsDisabled    (declared in TDACustomFieldCollection)

Allows to process events in child items.

property FieldEventsDisabled: Boolean read write

Fields    (declared in TDACustomFieldCollection)

Provides access to specific field.

property Fields[Index: Integer]: TDACustomField read write

Fields

This indexer property gives access to the individual fields contained in the collection.

property Fields[Index: Integer]: TDAField read write

FindField (string): TDACustomField    (declared in TDACustomFieldCollection)

Returns an item with the specified name.

function FindField(const aName: string): TDACustomField

Parameters:

  • aName: name of the searched field

FindField (string): TDAField

Returns an item with the specified name.

function FindField(const aName: string): TDAField

Parameters:

  • aName:

FindItem  override    (declared in TSearcheableCollectionCached)

Finds the first occurrence of the item with the supplied name. Search is case-insensitive.

function FindItem(const aName: string): TCollectionItem

Parameters:

  • aName: the supplied name

FindUniqueName    (declared in TSearcheableCollection)

Returns the supplied name if the item with that name is absent in the collection or adds a number to it and sequentially increments it until the result is unique.

function FindUniqueName(const iBaseName: string): string

Parameters:

  • iBaseName: the supplied name

FindUniqueNameEx    (declared in TSearcheableCollection)

Does the same as FindUniqueName, but uses a template with a numeric parameter as second argument, it should be compatible with the Delphi Format function.

function FindUniqueNameEx(const iBaseName: string; const iNumberedName: string): string

Parameters:

  • iBaseName: the supplied name
  • iNumberedName: numeric parameter

GetCount  protected    (declared in TSearcheableInterfacedCollection)

Does nothing, should be implemented in the descendant.

function GetCount: Integer

GetDefaultItem    (declared in TSearcheableCollection)

Looks for the first occurrence of the item that has a boolean property with the name "Default" and the value true. Raises an exception if no such item can be found.

function GetDefaultItem: TCollectionItem

GetItemDefault  protected dynamic    (declared in TSearcheableCollection)

Returns default item's name

function GetItemDefault(anItem: TCollectionItem): Boolean

Parameters:

  • anItem: given item

GetItemName  protected override    (declared in TDACustomFieldCollection)

Gets the name of the specified item.

function GetItemName(anItem: TCollectionItem): string

Parameters:

  • anItem: the specified item.

IsCompatibleV4    (declared in TDACustomFieldCollection)

Specifies DA4 compatible mode.

property IsCompatibleV4: Boolean read write

ItemByName    (declared in TSearcheableCollection)

Returns an item with the specified name.

function ItemByName(const aName: string): TCollectionItem

Parameters:

  • aName: fClientFields

ItemName  protected virtual    (declared in TSearcheableCollection)

Returns the string "item".

function ItemName: string

MergeDataDictionaries  protected virtual    (declared in TDACustomFieldCollection)

Returns False.

function MergeDataDictionaries: Boolean

MoveItem    (declared in TSearcheableCollection)

Moves the item from one position to another. Checks boundaries.

procedure MoveItem(iFromIndex: Integer; iToIndex: Integer)

Parameters:

  • iFromIndex: old index
  • iToIndex: new index

Notify  protected override    (declared in TSearcheableCollectionCached)

Notifies about the adding or removal of an item if the event handler is assigned. If an item with an empty name is added and items without name are not allowed, it sets the name to "Item" plus number.

procedure Notify(Item: TCollectionItem; Action: TCollectionNotification)

Parameters:

  • Item: given item
  • Action: action

OnFieldAfterUpdate    (declared in TDACustomFieldCollection)

This event is fired if field was updated

property OnFieldAfterUpdate: TDAFieldNotifyEvent read write
delegate: procedure OnFieldAfterUpdate(Sender: TDACustomField)

OnFieldBeforeUpdate    (declared in TDACustomFieldCollection)

This event is fired before field was updated

property OnFieldBeforeUpdate: TDAFieldNotifyEvent read write
delegate: procedure OnFieldBeforeUpdate(Sender: TDACustomField)

OnItemRemoved    (declared in TSearcheableCollection)

Event handler for removing an item.

property OnItemRemoved: TDAItemRemovedEvent read write
delegate: procedure OnItemRemoved(aSender: TObject; const aName: string)

OnItemRenamed    (declared in TSearcheableCollection)

Event handler for renaming an item.

property OnItemRenamed: TDAItemRenamedEvent read write
delegate: procedure OnItemRenamed(aSender: TObject; const aOldName: string; const aNewName: string)

PrimaryKeyFieldCount    (declared in TDACustomFieldCollection)

Calculates number of fields that have InPrimaryKey = True;

property PrimaryKeyFieldCount: Integer read

QueryInterface  protected stdcall    (declared in TSearcheableInterfacedCollection)

Returns a reference to a specified interface if the object supports that interface. This is one of the methods introduced by the IUnknown interface.

function QueryInterface(const IID: TGUID; out Obj: ): HResult

Parameters:

  • IID: Identifier of the interface to return
  • Obj: Variable to store the returned interface reference to

SetItemName  protected override    (declared in TDACustomFieldCollection)

Sets a new name for the specified item.

function SetItemName(anItem: TCollectionItem; const aName: string): string

Parameters:

  • anItem: item
  • aName: name

TriggerOnItemRemoved  override    (declared in TSearcheableCollectionCached)

Calls the event handler if it was assigned.

procedure TriggerOnItemRemoved(const iName: string)

Parameters:

  • iName: item name

TriggerOnItemRenamed  override    (declared in TSearcheableCollectionCached)

Calls the event handler if it was assigned.

procedure TriggerOnItemRenamed(const iOldName: string; const iNewName: string)

Parameters:

  • iOldName: old name
  • iNewName: new name

Unbind    (declared in TDACustomFieldCollection)

Unbinds early binded collections

procedure Unbind

 

DataDictionary    (declared in TDACustomFieldCollection)

Gets/sets the DataDictionary property.

property DataDictionary: IDADataDictionary read write

FieldEventsDisabled    (declared in TDACustomFieldCollection)

Allows to process events in child items.

property FieldEventsDisabled: Boolean read write

Fields    (declared in TDACustomFieldCollection)

Provides access to specific field.

property Fields[Index: Integer]: TDACustomField read write

Fields

This indexer property gives access to the individual fields contained in the collection.

property Fields[Index: Integer]: TDAField read write

IsCompatibleV4    (declared in TDACustomFieldCollection)

Specifies DA4 compatible mode.

property IsCompatibleV4: Boolean read write

PrimaryKeyFieldCount    (declared in TDACustomFieldCollection)

Calculates number of fields that have InPrimaryKey = True;

property PrimaryKeyFieldCount: Integer read

 

constructor Create (TPersistent)

Creates a new instance.

constructor Create(aOwner: TPersistent)

Parameters:

  • aOwner: owner

constructor Create (TPersistent, TDAFieldClass)    (declared in TDACustomFieldCollection)

Creates a new instance.

constructor Create(aOwner: TPersistent; aFieldClass: TDAFieldClass)

Parameters:

  • aOwner: owner
  • aFieldClass: field class

constructor Create (TPersistent, TCollectionItemClass)    (declared in TSearcheableCollectionCached)

Initializes the collection with the supplied parameters.

constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass)

Parameters:

  • AOwner: owner
  • ItemClass: item class

Add  reintroduce overload    (declared in TDACustomFieldCollection)

Creates new TDAField and add it to collection

function Add: TDAField

Add (string, TDADataType, Integer): TDACustomField  overload    (declared in TDACustomFieldCollection)

Creates new TDAField, fills with specified properties and adds it to collection

function Add(const aName: string; aType: TDADataType; aSize: Integer): TDACustomField

Parameters:

  • aName: field name
  • aType: field type
  • aSize: field size

Assign  override    (declared in TDACustomFieldCollection)

Calls AssignFieldCollection if source is TDACustomFieldCollection

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

AssignFieldCollection    (declared in TDACustomFieldCollection)

Copies the contents of another collection to the object where the method is executed.

procedure AssignFieldCollection(Source: TDACustomFieldCollection)

Parameters:

  • Source: Instance whose properties will be copied

Bind (TDataset)  overload    (declared in TDACustomFieldCollection)

Binds child fields with aDataset

procedure Bind(aDataset: TDataset)

Parameters:

  • aDataset: dataset

Bind (IDASQLCommandNativeObject)  overload    (declared in TDACustomFieldCollection)

Binds child fields with aNativeObject

procedure Bind(aNativeObject: IDASQLCommandNativeObject)

Parameters:

  • aNativeObject: native object

CloneItem    (declared in TSearcheableCollection)

Inserts a copy of an item and names it "Copy nn of " of the cloned item name.

function CloneItem(iIndex: Integer): Integer

Parameters:

  • iIndex: position.

FieldByName (string): TDACustomField    (declared in TDACustomFieldCollection)

Finds a field based on its name. If the specified field does not exist, FieldByName raises an exception.

function FieldByName(const aName: string): TDACustomField

Parameters:

  • aName: name of the searched field

FieldByName (string): TDAField  reintroduce

Returns an item with the specified name. If no matching field is defined, an exception will be raised.

function FieldByName(const aName: string): TDAField

Parameters:

  • aName:

FindField (string): TDACustomField    (declared in TDACustomFieldCollection)

Returns an item with the specified name.

function FindField(const aName: string): TDACustomField

Parameters:

  • aName: name of the searched field

FindField (string): TDAField

Returns an item with the specified name.

function FindField(const aName: string): TDAField

Parameters:

  • aName:

FindItem  override    (declared in TSearcheableCollectionCached)

Finds the first occurrence of the item with the supplied name. Search is case-insensitive.

function FindItem(const aName: string): TCollectionItem

Parameters:

  • aName: the supplied name

FindUniqueName    (declared in TSearcheableCollection)

Returns the supplied name if the item with that name is absent in the collection or adds a number to it and sequentially increments it until the result is unique.

function FindUniqueName(const iBaseName: string): string

Parameters:

  • iBaseName: the supplied name

FindUniqueNameEx    (declared in TSearcheableCollection)

Does the same as FindUniqueName, but uses a template with a numeric parameter as second argument, it should be compatible with the Delphi Format function.

function FindUniqueNameEx(const iBaseName: string; const iNumberedName: string): string

Parameters:

  • iBaseName: the supplied name
  • iNumberedName: numeric parameter

GetCount  protected    (declared in TSearcheableInterfacedCollection)

Does nothing, should be implemented in the descendant.

function GetCount: Integer

GetDefaultItem    (declared in TSearcheableCollection)

Looks for the first occurrence of the item that has a boolean property with the name "Default" and the value true. Raises an exception if no such item can be found.

function GetDefaultItem: TCollectionItem

GetItemDefault  protected dynamic    (declared in TSearcheableCollection)

Returns default item's name

function GetItemDefault(anItem: TCollectionItem): Boolean

Parameters:

  • anItem: given item

GetItemName  protected override    (declared in TDACustomFieldCollection)

Gets the name of the specified item.

function GetItemName(anItem: TCollectionItem): string

Parameters:

  • anItem: the specified item.

ItemByName    (declared in TSearcheableCollection)

Returns an item with the specified name.

function ItemByName(const aName: string): TCollectionItem

Parameters:

  • aName: fClientFields

ItemName  protected virtual    (declared in TSearcheableCollection)

Returns the string "item".

function ItemName: string

MergeDataDictionaries  protected virtual    (declared in TDACustomFieldCollection)

Returns False.

function MergeDataDictionaries: Boolean

MoveItem    (declared in TSearcheableCollection)

Moves the item from one position to another. Checks boundaries.

procedure MoveItem(iFromIndex: Integer; iToIndex: Integer)

Parameters:

  • iFromIndex: old index
  • iToIndex: new index

Notify  protected override    (declared in TSearcheableCollectionCached)

Notifies about the adding or removal of an item if the event handler is assigned. If an item with an empty name is added and items without name are not allowed, it sets the name to "Item" plus number.

procedure Notify(Item: TCollectionItem; Action: TCollectionNotification)

Parameters:

  • Item: given item
  • Action: action

QueryInterface  protected stdcall    (declared in TSearcheableInterfacedCollection)

Returns a reference to a specified interface if the object supports that interface. This is one of the methods introduced by the IUnknown interface.

function QueryInterface(const IID: TGUID; out Obj: ): HResult

Parameters:

  • IID: Identifier of the interface to return
  • Obj: Variable to store the returned interface reference to

SetItemName  protected override    (declared in TDACustomFieldCollection)

Sets a new name for the specified item.

function SetItemName(anItem: TCollectionItem; const aName: string): string

Parameters:

  • anItem: item
  • aName: name

TriggerOnItemRemoved  override    (declared in TSearcheableCollectionCached)

Calls the event handler if it was assigned.

procedure TriggerOnItemRemoved(const iName: string)

Parameters:

  • iName: item name

TriggerOnItemRenamed  override    (declared in TSearcheableCollectionCached)

Calls the event handler if it was assigned.

procedure TriggerOnItemRenamed(const iOldName: string; const iNewName: string)

Parameters:

  • iOldName: old name
  • iNewName: new name

Unbind    (declared in TDACustomFieldCollection)

Unbinds early binded collections

procedure Unbind

 

OnFieldAfterUpdate    (declared in TDACustomFieldCollection)

This event is fired if field was updated

property OnFieldAfterUpdate: TDAFieldNotifyEvent read write
delegate: procedure OnFieldAfterUpdate(Sender: TDACustomField)

OnFieldBeforeUpdate    (declared in TDACustomFieldCollection)

This event is fired before field was updated

property OnFieldBeforeUpdate: TDAFieldNotifyEvent read write
delegate: procedure OnFieldBeforeUpdate(Sender: TDACustomField)

OnItemRemoved    (declared in TSearcheableCollection)

Event handler for removing an item.

property OnItemRemoved: TDAItemRemovedEvent read write
delegate: procedure OnItemRemoved(aSender: TObject; const aName: string)

OnItemRenamed    (declared in TSearcheableCollection)

Event handler for renaming an item.

property OnItemRenamed: TDAItemRenamedEvent read write
delegate: procedure OnItemRenamed(aSender: TObject; const aOldName: string; const aNewName: string)