LookupDataColumn

Overview

LookupDataColumn is a specialization of the general DataColumn class, and represents a field for which the value is not stored directly in the DataTable but looked up from a secondary table via a reference source field. The source field is another field defined in the same table as the lookup field, and its value will be matched against a lookup key field in the secondary table, to obtain the referenced row. The lookup result field from the secondary table will be used as resulting value.

Lookup fields are often used with tables from a relational database containing Foreign Key. For example, an "Orders" table might have references to a customers via a "CustomerID" field (this field is called the foreign key). The values in "CustomerID" will match values of the Primary Key in a "Customers" table (say, called "ID"). A lookup field could then be configured to follow this relation, obtain the "CustomerName" field and make it available locally within the "Orders" DataTable.

To use this field, compose its instance providing a columnName, sourceColumn, lookupKeyColumn and lookupResultColumn. Then add created column to the table.

Some other notes to consider: * the refference to the lookup table will be retrieved from the lookupKeyColumn. * all mentioned class fields are available through LookupDataColumn getters.

Location

 

constructor    (declared in DataColumn)

Emty constructor that creates an instance of the DataColumn

 

constructor

 

LookupDataColumn()

constructor (String)    (declared in DataColumn)

Creates an instance of a column with the given name. Default data type is String.

 

constructor(aName: String)

 

LookupDataColumn(String aName)

Parameters:

  • aName: Given column name.

constructor (String, Class)    (declared in DataColumn)

Creates an instance of a column with the given name and value type.

 

constructor(aName: String; aDataType: Class)

 

LookupDataColumn(String aName, Class aDataType)

Parameters:

  • aName: Given column name.
  • aDataType: Given column data type.

constructor (String, DataColumn, DataColumn, DataColumn)

Creates and initializes a new LookupDataColumn.

 

constructor(aColumnName: String; aSourceColumn: DataColumn; aLookupKeyColumn: DataColumn; aLookupResultColumn: DataColumn)

 

LookupDataColumn(String aColumnName, DataColumn aSourceColumn, DataColumn aLookupKeyColumn, DataColumn aLookupResultColumn)

Parameters:

  • aColumnName: The name of the lookup column.
  • aSourceColumn: The instance of the column that defines KEY values.
  • aLookupKeyColumn: The column of the lookup table that contains KEY values.
  • aLookupResultColumn: The column of the lookup table that contains actual values.

AllowNull    (declared in DataColumn)

 

property AllowNull: Boolean read write;

 

Boolean AllowNull { __get; __set; }

AutoInc    (declared in DataColumn)

 

property AutoInc: Boolean read write;

 

Boolean AutoInc { __get; __set; }

AutoIncStart    (declared in DataColumn)

 

property AutoIncStart: Int64 read write;

 

Int64 AutoIncStart { __get; __set; }

AutoIncStep    (declared in DataColumn)

 

property AutoIncStep: Int64 read write;

 

Int64 AutoIncStep { __get; __set; }

Caption    (declared in DataColumn)

 

property Caption: String read write;

 

String Caption { __get; __set; }

clone    (declared in DataColumn)

Creates a clone of the current DataColumn.

 

method clone: DataColumn

 

DataColumn clone()

ColumnName    (declared in DataColumn)

 

property ColumnName: String read write;

 

String ColumnName { __get; __set; }

DataType    (declared in DataColumn)

 

property DataType: Class read write;

 

Class DataType { __get; __set; }

DefaultValue    (declared in DataColumn)

 

property DefaultValue: Object read write;

 

Object DefaultValue { __get; __set; }

intEvaluate  protected

This method fetches the result value, based on how the lookup column was setup.

The parameter of the method is the KEY value of the source column of the row that is currently being processed. The method searches for a lookup table's row that has the specified value in the lookup key column. When the key values match, it returns a value of the lookup result column from the matched row.

Note: You can inherit from the LookupDataColumn and override this method to implement your own logic of evaluation(i.e. comparison and searching for lookup rows). Just remember, that the input parameter of the method is the key, we need to find, while the result will be considered as a value of the LookupDataColumn fro the current row.

 

method intEvaluate(aSourceValue: Object): Object

 

Object intEvaluate(Object aSourceValue)

Parameters:

  • aSourceValue: A key value of the source column from the current row.

intSetReadOnly  protected

Always returns TRUE, because lookup column is always read-only.

 

method intSetReadOnly(aValue: Boolean)

 

void intSetReadOnly(Boolean aValue)

Parameters:

  • aValue: A new value to set (ignored here).

LookupKeyColumn

 

property LookupKeyColumn: DataColumn read;

 

DataColumn LookupKeyColumn { __get; }

LookupResultColumn

 

property LookupResultColumn: DataColumn read;

 

DataColumn LookupResultColumn { __get; }

LookupTable

 

property LookupTable: DataTable read;

 

DataTable LookupTable { __get; }

MaxLength    (declared in DataColumn)

 

property MaxLength: Integer read write;

 

Integer MaxLength { __get; __set; }

Ordinal    (declared in DataColumn)

 

property Ordinal: Integer read write;

 

Integer Ordinal { __get; __set; }

Properties    (declared in DataColumn)

 

property Properties: PropertyCollection read;

 

PropertyCollection Properties { __get; }

ReadOnly    (declared in DataColumn)

 

property ReadOnly: Boolean read write;

 

Boolean ReadOnly { __get; __set; }

setAutoInc    (declared in DataColumn)

Helper method to set incrementation mode of the column. Allows to enable autoincrementation, set its start value and increment value in one call.

 

method setAutoInc(aValue: Boolean; aStart: Long; aStep: Long)

 

void setAutoInc(Boolean aValue, Long aStart, Long aStep)

Parameters:

  • aValue: true - if auto inc enabled; otherwise - false.
  • aStart: The start value of values' incrementation
  • aStep: The increment/step value by which row's value wil be increased

SourceColumn

 

property SourceColumn: DataColumn read;

 

DataColumn SourceColumn { __get; }

Table    (declared in DataColumn)

 

property Table: DataTable read write;

 

DataTable Table { __get; __set; }

 

AllowNull    (declared in DataColumn)

 

property AllowNull: Boolean read write;

 

Boolean AllowNull { __get; __set; }

AutoInc    (declared in DataColumn)

 

property AutoInc: Boolean read write;

 

Boolean AutoInc { __get; __set; }

AutoIncStart    (declared in DataColumn)

 

property AutoIncStart: Int64 read write;

 

Int64 AutoIncStart { __get; __set; }

AutoIncStep    (declared in DataColumn)

 

property AutoIncStep: Int64 read write;

 

Int64 AutoIncStep { __get; __set; }

Caption    (declared in DataColumn)

 

property Caption: String read write;

 

String Caption { __get; __set; }

ColumnName    (declared in DataColumn)

 

property ColumnName: String read write;

 

String ColumnName { __get; __set; }

DataType    (declared in DataColumn)

 

property DataType: Class read write;

 

Class DataType { __get; __set; }

DefaultValue    (declared in DataColumn)

 

property DefaultValue: Object read write;

 

Object DefaultValue { __get; __set; }

LookupKeyColumn

 

property LookupKeyColumn: DataColumn read;

 

DataColumn LookupKeyColumn { __get; }

LookupResultColumn

 

property LookupResultColumn: DataColumn read;

 

DataColumn LookupResultColumn { __get; }

LookupTable

 

property LookupTable: DataTable read;

 

DataTable LookupTable { __get; }

MaxLength    (declared in DataColumn)

 

property MaxLength: Integer read write;

 

Integer MaxLength { __get; __set; }

Ordinal    (declared in DataColumn)

 

property Ordinal: Integer read write;

 

Integer Ordinal { __get; __set; }

Properties    (declared in DataColumn)

 

property Properties: PropertyCollection read;

 

PropertyCollection Properties { __get; }

ReadOnly    (declared in DataColumn)

 

property ReadOnly: Boolean read write;

 

Boolean ReadOnly { __get; __set; }

SourceColumn

 

property SourceColumn: DataColumn read;

 

DataColumn SourceColumn { __get; }

Table    (declared in DataColumn)

 

property Table: DataTable read write;

 

DataTable Table { __get; __set; }

 

constructor    (declared in DataColumn)

Emty constructor that creates an instance of the DataColumn

 

constructor

 

LookupDataColumn()

constructor (String)    (declared in DataColumn)

Creates an instance of a column with the given name. Default data type is String.

 

constructor(aName: String)

 

LookupDataColumn(String aName)

Parameters:

  • aName: Given column name.

constructor (String, Class)    (declared in DataColumn)

Creates an instance of a column with the given name and value type.

 

constructor(aName: String; aDataType: Class)

 

LookupDataColumn(String aName, Class aDataType)

Parameters:

  • aName: Given column name.
  • aDataType: Given column data type.

constructor (String, DataColumn, DataColumn, DataColumn)

Creates and initializes a new LookupDataColumn.

 

constructor(aColumnName: String; aSourceColumn: DataColumn; aLookupKeyColumn: DataColumn; aLookupResultColumn: DataColumn)

 

LookupDataColumn(String aColumnName, DataColumn aSourceColumn, DataColumn aLookupKeyColumn, DataColumn aLookupResultColumn)

Parameters:

  • aColumnName: The name of the lookup column.
  • aSourceColumn: The instance of the column that defines KEY values.
  • aLookupKeyColumn: The column of the lookup table that contains KEY values.
  • aLookupResultColumn: The column of the lookup table that contains actual values.

clone    (declared in DataColumn)

Creates a clone of the current DataColumn.

 

method clone: DataColumn

 

DataColumn clone()

intEvaluate  protected

This method fetches the result value, based on how the lookup column was setup.

The parameter of the method is the KEY value of the source column of the row that is currently being processed. The method searches for a lookup table's row that has the specified value in the lookup key column. When the key values match, it returns a value of the lookup result column from the matched row.

Note: You can inherit from the LookupDataColumn and override this method to implement your own logic of evaluation(i.e. comparison and searching for lookup rows). Just remember, that the input parameter of the method is the key, we need to find, while the result will be considered as a value of the LookupDataColumn fro the current row.

 

method intEvaluate(aSourceValue: Object): Object

 

Object intEvaluate(Object aSourceValue)

Parameters:

  • aSourceValue: A key value of the source column from the current row.

intSetReadOnly  protected

Always returns TRUE, because lookup column is always read-only.

 

method intSetReadOnly(aValue: Boolean)

 

void intSetReadOnly(Boolean aValue)

Parameters:

  • aValue: A new value to set (ignored here).

setAutoInc    (declared in DataColumn)

Helper method to set incrementation mode of the column. Allows to enable autoincrementation, set its start value and increment value in one call.

 

method setAutoInc(aValue: Boolean; aStart: Long; aStep: Long)

 

void setAutoInc(Boolean aValue, Long aStart, Long aStep)

Parameters:

  • aValue: true - if auto inc enabled; otherwise - false.
  • aStart: The start value of values' incrementation
  • aStep: The increment/step value by which row's value wil be increased

See Also

CalculatedDataColumn