Rows Property

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

Use the Rows property to get the LogTableRow object corresponding to the desired row of the current log table. Note that for tree-like tables, this property lets you only obtain the top-most rows. To obtain the child row, use the ChildRow property of the parent LogTableRow object.

The total number of rows in the table is specified by the RowCount property.

Declaration

LogTableDataObj.Rows(Index)

Read-Only Property A LogTableRow object
LogTableDataObj An expression, variable or parameter that specifies a reference to a LogTableData 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 row within the table. The index is zero-based, that is the first row has index 0, the second - 1, and so on. Index of the last row is equal to RowCount - 1.

Property Value

A LogTableRow object corresponding to the desired row of the log table.

Remarks

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

Example

The code below obtains the total number of the specified log item's rows and then posts the values of all the rows to the test log.

JavaScript, JScript

function LogTableDataExample()
{
  // Obtains a collection of logs
  var LogsCol = Project.Logs;
  // Obtains the first log item
  var LogItem = LogsCol.LogItem(0);
  // Obtains the first dataset
  var DataSet = LogItem.Data(0);
  
  // Obtains the total number of rows in the dataset
  var Num = DataSet.RowCount;
  // Iterates through the rows
  for (var i = 0; i < Num; i++)
  {
    var Row = DataSet.Rows(i);
    // Obtains the message of the current row
    var Val = Row.ValueByName("Message");
    Log.Message(Val);
  }
}

Python

def LogTableDataExample():
  # Obtains a collection of logs
  LogsCol = Project.Logs
  # Obtains the first log item
  LogItem = LogsCol.LogItem[0]
  # Obtains the first dataset
  DataSet = LogItem.Data[0]
  # Obtains the total number of rows in the dataset
  Num = DataSet.RowCount
  for i in range(0, Num):
    Row = DataSet.Rows[i]
    # Obtains the message of the current row
    Val = Row.ValueByName["Message"]
    Log.Message(Val)

VBScript

Sub LogTableDataExample()

  ' Obtains a collection of logs
  Set LogsCol = Project.Logs
  ' Obtains the first log item
  Set LogItem = LogsCol.LogItem(0)
  ' Obtains the first dataset
  Set DataSet = LogItem.Data(0)
  
  ' Obtains the total number of rows in the dataset
  Num = DataSet.RowCount
  ' Iterates through the rows
  For i = 0 to (Num - 1)
    Set Row = DataSet.Rows(i)
    ' Obtains the message of the current row
    Val = Row.ValueByName("Message")
    Log.Message(Val)
  Next
      
End Sub

DelphiScript

function LogTableDataExample;
var LogsCol, LogItem, DataSet, Num, i, Row, Val;
begin

  // Obtains a collection of logs
  LogsCol := Project.Logs;
  // Obtains the first log item
  LogItem := LogsCol.LogItem[0];
  // Obtains the first dataset
  DataSet := LogItem.Data[0];
  
  // Obtains the total number of rows in the dataset
  Num := DataSet.RowCount;
  // Iterates through the rows
  for i := 0 to (Num - 1) do
  begin
    Row := DataSet.Rows[i];
    // Obtains the message of the current row
    Val := Row.ValueByName('Message');
    Log.Message(Val);
  end;

end;

C++Script, C#Script

function LogTableDataExample()
{
  // Obtains a collection of logs
  var LogsCol = Project["Logs"];
  // Obtains the first log item
  var LogItem = LogsCol["LogItem"](0);
  // Obtains the first dataset
  var DataSet = LogItem["Data"](0);
  
  // Obtains the total number of rows in the dataset
  var Num = DataSet["RowCount"];
  // Iterates through the rows
  for (var i = 0; i < Num; i++)
  {
    var Row = DataSet["Rows"](i);
    // Obtains the message of the current row
    var Val = Row["ValueByName"]("Message");
    Log["Message"](Val);
  }
}

See Also

Access Test Log Contents from Tests
RowCount Property
LogTableRow Object

Highlight search results