Column Property

Applies to TestComplete 15.0, last modified on October 22, 2021

Description

The Column property returns the LogColumn object that provides scripting access to the desired table column. You can then use the resulting LogColumn object when obtaining values stored in table cells.

Note that you can also obtain the desired column by its name using the ColumnByName property. The total number of columns in the table is specified by the ColumnCount property.

Declaration

LogTableDataSchemeObj.Column(Index)

Read-Only Property A LogColumn object
LogTableDataSchemeObj An expression, variable or parameter that specifies a reference to a LogTableDataScheme object
Index [in]    Required    Integer    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

The index of the desired column. The index is zero-based, that is the first column has index 0, the second - 1, and so on. Index of the last column is ColumnCount - 1.

Property Value

A LogColumn object corresponding to the desired column.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the Column property in square brackets: Column[Index].

Example

The code below obtains the name and data type of the specified test log column using the LogColumn object and its properties.

JavaScript, JScript

function LogColumn()
{
  // Obtains a collection of logs
  var LogsCol = Project.Logs;
  // Obtains the first log item
  var LogItem = LogsCol.LogItem(0);
  // Obtains the first dataset
  // of the specified log item
  var LogData = LogItem.Data(0);
  // Obtains the scheme of the dataset
  var Sch = LogData.Scheme;
  // Obtains information about the third column
  var Column = Sch.Column(2);
  // Obtains the name of the third column
  var Name = Column.Name;
  Log.Message("The " + Name + " column contains the following data:");
  
  // Obtains the data type of the third column
  switch (Column.DataType)
  {
    case ctInteger:
    {
      Log.Message("integer numbers");
      break;
    }
    case ctString:
    {
      Log.Message("strings");
      break;
    }
    case ctFloat:
    {
      Log.Message("floating-point numbers");
      break;
    }
    case ctBoolean:
    {
      Log.Message("boolean values");
      break;
    }
    case ctImage:
    {
      Log.Message("images");
      break;
    }
    case ctHyperlink:
    {
      Log.Message("hyperlinks");
      break;
    }
    case ctDateTime:
    {
      Log.Message("date or time values");
      break;
    }
  }
}

Python

def LogColumn():
  # Obtains a collection of logs
  LogsCol = Project.Logs
  # Obtains the first log item
  LogItem = LogsCol.LogItem[0]
  # Obtains the first dataset
  # of the specified log item
  LogData = LogItem.Data[0]
  # Obtains the scheme of the dataset
  Sch = LogData.Scheme
  # Obtains information about the third column
  Column = Sch.Column[2]
  # Obtains the name of the third column
  Name = Column.Name
  Log.Message("The " + Name + " column contains the following data:") 
  # Obtains the data type of the third column
  if Column.DataType == ctInteger:
    Log.Message("integer numbers")
  elif Column.DataType == ctString:
    Log.Message("strings")
  elif Column.DataType == ctFloat:
    Log.Message("floating-point numbers");
  elif Column.DataType == ctBoolean:
    Log.Message("boolean values")
  elif Column.DataType == ctImage:
    Log.Message("images")
  elif Column.DataType == ctHyperlink:
    Log.Message("hyperlinks")
  elif Column.DataType == ctDateTime:
    Log.Message("date or time values")

VBScript

Sub LogColumn()
  ' Obtains a collection of logs
  Set LogsCol = Project.Logs
  ' Obtains the first log item
  Set LogItem = LogsCol.LogItem(0)
  ' Obtains the first dataset
  ' of the specified log item
  Set LogData = LogItem.Data(0)
  ' Obtains the scheme of the dataset
  Set Sch = LogData.Scheme
  ' Obtains information about the third column
  Set Column = Sch.Column(2)
  ' Obtains the name of the third column
  Name = Column.Name
  Log.Message("The " & Name & " column contains the following data:")
  
  ' Obtains the data type of the third column
  Select case Column.DataType
    case ctInteger: Log.Message("integer numbers")
    case ctString: Log.Message("strings")
    case ctFloat: Log.Message("floating-point numbers")
    case ctBoolean: Log.Message("boolean values")
    case ctImage: Log.Message("images")
    case ctHyperlink: Log.Message("hyperlinks")
    case ctDateTime: Log.Message("date or time values")
  End Select
 
End Sub

DelphiScript

function LogColumn;
var LogsCol, LogItem, LogData, Sch, Column, Name;
begin

  // Obtains a collection of logs
  LogsCol := Project.Logs;
  // Obtains the first log item
  LogItem := LogsCol.LogItem(0);
  // Obtains the first dataset
  // of the specified log item
  LogData := LogItem.Data(0);
  // Obtains the scheme of the dataset
  Sch := LogData.Scheme;
  // Obtains information about the third column
  Column := Sch.Column(2);
  // Obtains the name of the third column
  Name := Column.Name;
  Log.Message('The ' + Name + ' column contains the following data:');
  
  // Obtains the data type of the third column
  case Column.DataType of
    ctInteger: Result : = Log.Message('integer numbers');
    ctString: Result := Log.Message('strings');
    ctFloat: Result := Log.Message('floating-point numbers');
    ctBoolean: Result := Log.Message('boolean values');
    ctImage: Result := Log.Message('images');
    ctHyperlink: Result := Log.Message('hyperlinks');
    ctDateTime: Result := Log.Message('date or time values');
  end;

end;

C++Script, C#Script

function LogColumn()
{
  // Obtains a collection of logs
  var LogsCol = Project["Logs"];
  // Obtains the first log item
  var LogItem = LogsCol["LogItem"](0);
  // Obtains the first dataset
  // of the specified log item
  var LogData = LogItem["Data"](0);
  // Obtains the scheme of the dataset
  var Sch = LogData["Scheme"];
  // Obtains information about the third column
  var Column = Sch["Column"](2);
  // Obtains the name of the third column
  var Name = Column["Name"];
  Log["Message"]("The " + Name + " column contains the following data:");
  
  // Obtains the data type of the third column
  switch (Column["DataType"])
  {
    case ctInteger:
    {
      Log["Message"]("integer numbers");
      break;
    }
    case ctString:
    {
      Log["Message"]("strings");
      break;
    }
    case ctFloat:
    {
      Log["Message"]("floating-point numbers");
      break;
    }
    case ctBoolean:
    {
      Log["Message"]("boolean values");
      break;
    }
    case ctImage:
    {
      Log["Message"]("images");
      break;
    }
    case ctHyperlink:
    {
      Log["Message"]("hyperlinks");
      break;
    }
    case ctDateTime:
    {
      Log["Message"]("date or time values");
      break;
    }
  }
}

See Also

Access Test Log Contents from Tests
ColumnByName Property
ColumnCount Property

Highlight search results