Name Property

Applies to TestComplete 15.62, last modified on March 19, 2024

Description

The Name property returns the caption of the given column.

You can use the value of this property to obtain the column via the LogTableDataScheme.ColumnByName property or when obtaining the value stored in a single cell of this column via the LogTableRow.ValueByName property.

Declaration

LogColumnObj.Name

Read-Only Property String
LogColumnObj An expression, variable or parameter that specifies a reference to a LogColumn object

Applies To

The property is applied to the following object:

Property Value

A string holding the caption of the given table column. This is the value that you see in the column header of the test log.

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
DataType Property
ColumnByName Property
ValueByName Property

Highlight search results