RowCount Property

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

Description

Use the Table.RowCount property to obtain the number of data rows stored by the Table project element that corresponds to the Table object. You can then use this value to iterate through stored values.

Declaration

TableObj.RowCount

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

Applies To

The property is applied to the following object:

Property Value

An integer value that specifies the number of stored rows.

Example

The following example demonstrates how to use the RowCount and ColumnCount properties to iterate through the values stored in the Table project element.

JavaScript, JScript

function Test()
{
  var Table,RowCount, ColumnCount, Value, i, j, Row;
  // Obtains the Table element
  Table = Tables.OrdersTable;
  // Obtains the total number of rows in the table
  RowCount = Table.RowCount;
  // Obtains the total number of columns in the table
  ColumnCount = Table.ColumnCount;
  // Iterates through the rows
  for (i = 0; i < RowCount; i++)
    {
    Row = "";
    // Iterates through the columns
    for (j = 0; j < ColumnCount; j++)
      {
      // Obtains the current value
      Value = Table.Values(i, j);
      Row = Row + Value + "  ";
      }
    // Posts the current row to the test log
    Log.Message(Row);
    }

}

Python

def Test():
  # Obtains the Table element
  Table = Tables.OrdersTable
  # Obtains the total number of rows in the table
  RowCount = Table.RowCount
  # Obtains the total number of columns in the table
  ColumnCount = Table.ColumnCount
  # Iterates through the rows
  for i in range(0, RowCount):
    Row = ""
    # Iterates through the columns
    for j in range(0, ColumnCount):
      # Obtains the current value
      Value = Table.Values[i, j];
      Row = str(Row) + str(Value) + "  "
    # Posts the current row to the test log
    Log.Message(Row)

VBScript

Sub Test

  Dim Table,RowCount, ColumnCount, Value, i, j, Row
  ' Obtains the Table element
  Set Table = Tables.OrdersTable
  ' Obtains the total number of rows in the table
  RowCount = Table.RowCount
  ' Obtains the total number of columns in the table
  ColumnCount = Table.ColumnCount
  ' Iterates through the rows
  For i = 0 To RowCount - 1
    Row = ""
    ' Iterates through the columns
    For j = 0 To ColumnCount - 1
      ' Obtains the current value
      Value = Table.Values(i, j)
      Row = Row & Value & "  "
    Next
    ' Posts the current row to the test log
    Log.Message(Row)
  Next

End Sub

DelphiScript

procedure Test();
var Table,RowCount, ColumnCount, Value, i, j, Row;
begin
  // Obtains the Table element
  Table := Tables.OrdersTable;
  // Obtains the total number of rows in the table
  RowCount := Table.RowCount;
  // Obtains the total number of columns in the table
  ColumnCount := Table.ColumnCount;
  // Iterates through the rows
  for i := 0 to RowCount - 1 do
    begin
    Row := '';
    // Iterates through the columns
    for j := 0 to ColumnCount - 1 do
      begin
      // Obtains the current value
      Value := Table.Values(i, j);
      Row := Row + Value + '  ';
      end;
    // Posts the current row to the test log
    Log.Message(Row);
    end;

end;

C++Script, C#Script

function Test()
{
  var Table,RowCount, ColumnCount, Value, i, j, Row;
  // Obtains the Table element
  Table = Tables["OrdersTable"];
  // Obtains the total number of rows in the table
  RowCount = Table["RowCount"];
  // Obtains the total number of columns in the table
  ColumnCount = Table["ColumnCount"];
  // Iterates through the rows
  for (i = 0; i < RowCount; i++)
    {
    Row = "";
    // Iterates through the columns
    for (j = 0; j < ColumnCount; j++)
      {
      // Obtains the current value
      Value = Table["Values"](i, j);
      Row = Row + Value + "  ";
      }
    // Posts the current row to the test log
    Log["Message"](Row);
    }

}

See Also

About Table Checkpoints
Values Property
ValuesSelected Property
ColumnIndex Property
ColumnCount Property

Highlight search results