RowCount Property

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

Description

The RowCount property returns the total number of rows in the given table represented by the LogTableDataObj object. Note that for tree-like tables (for example, the one displayed in the Test Log pane of the generic test log), only the top-most rows are counted.

To obtain the single table row, use the Rows property.

Declaration

LogTableDataObj.RowCount

Read-Only Property Integer
LogTableDataObj An expression, variable or parameter that specifies a reference to a LogTableData object

Applies To

The property is applied to the following object:

Property Value

An integer number that means the total number of rows of the given log table.

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
Rows Property

Highlight search results