LogTableRow Object

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

The tables in the TestComplete test log can be two types: common tables and tree-like tables (for example, the Test Log table in the generic script log). Each row of the test log table, including child rows of tree-like tables, is represented as the LogTableRow object.

To obtain the LogTableRow object from scripts, use the Rows property of the LogTableData object. To access the child row of the tree-like log table, use the ChildRow property of the parent LogTableRow object.

The LogTableRow object contains properties that let you obtain values stored in single cells. It also lets you access the child datasets of the given table row.

Members

Example

The following example demonstrates how you can access the LogTableRow object. The code snippet obtains a log item and gets the first row of the table it contains. After that, it posts information stored in one of the row’s cells.

JavaScript, JScript

function LogTableRowSample()
{
  // Obtains a log item by its index
  LogItem = Project.Logs.LogItem(0);
  // Obtains the log item’s dataset
  LogData = LogItem.Data(0);

  DType = LogData.Scheme.DataType;
  // Checks whether the dataset corresponds to the table
  if (DType == 0)
  {
    // Obtains the table’s row by its index
    Row = LogData.Rows(0);
    // Obtains the value stored in the row’s cell
    Value = Row.ValueByName("Message");
    // Posts the value to the test log
    Log.Message(aqConvert.VarToStr(Value));
  }

}

Python

def LogTableRowSample():
  # Obtains a log item by its index 
  LogItem = Project.Logs.LogItem[0]
  # Obtains the log item's dataset 
  LogData = LogItem.Data[0]
  DType = LogData.Scheme.DataType
  # Checks whether the dataset corresponds to the table 
  if DType == 0:
    # Obtains the table's row by its index 
    Row = LogData.Rows[0]
    # Obtains the value stored in the row's cell
    Value = Row.ValueByName["Message"]
    # Posts the value to the test log 
    Log.Message(aqConvert.VarToStr(Value))

VBScript

Sub LogTableRowSample

  ' Obtains a log item by its index
  Set LogItem = Project.Logs.LogItem(0)
  ' Obtains the log item’s dataset
  Set LogData = LogItem.Data(0)

  DType = LogData.Scheme.DataType
  ' Checks whether the dataset corresponds to the table
  If DType = 0 Then
    ' Obtains the table’s row by its index
    Set Row = LogData.Rows(0)
    ' Obtains the value stored in the row’s cell
    Value = Row.ValueByName("Message")
    ' Posts the value to the test log
    Log.Message(aqConvert.VarToStr(Value))
  End If

End Sub

DelphiScript

procedure LogTableRowSample();
var LogItem, LogData, DType, Row, Value;
begin
  // Obtains a log item by its index
  LogItem := Project.Logs.LogItem[0];
  // Obtains the log item’s dataset
  LogData := LogItem.Data[0];

  DType := LogData.Scheme.DataType;
  // Checks whether the dataset corresponds to the table
  if DType = 0 then
  begin
    // Obtains the table’s row by its index
    Row := LogData.Rows[0];
    // Obtains the value stored in the row’s cell
    Value := Row.ValueByName['Message'];
    // Posts the value to the test log
    Log.Message(aqConvert.VarToStr(Value));
  end;

end;

C++Script, C#Script

function LogTableRowSample()
{
  // Obtains a log item by its index
  LogItem = Project["Logs"]["LogItem"](0);
  // Obtains the log item’s dataset
  LogData = LogItem["Data"](0);

  DType = LogData["Scheme"]["DataType"];
  // Checks whether the dataset corresponds to the table
  if (DType == 0)
  {
    // Obtains the table’s row by its index
    Row = LogData["Rows"](0);
    // Obtains the value stored in the row’s cell
    Value = Row["ValueByName"]("Message");
    // Posts the value to the test log
    Log["Message"](aqConvert["VarToStr"](Value));
  }

}

See Also

Access Test Log Contents from Tests
LogTableData Object
LogColumn Object

Highlight search results