Description
The TableVariable
object corresponds to a project, project suite or keyword test variable of the Table type. Use the RowCount
property to get or set the number of rows in the table the variable stores. 0 indicates the table has no rows.
Declaration
TableVariableObj.RowCount
Read-Write Property | Integer |
TableVariableObj | An expression, variable or parameter that specifies a reference to a TableVariable object |
Applies To
The property is applied to the following object:
Property Value
An integer value that is the number of rows in the table.
Example
The code below shows how you can post the total number of columns and rows to the log:
JavaScript, JScript
function Test1()
{
var MyVar;
MyVar = Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn("LastColumn");
// Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " + MyVar.ColumnCount);
Log.Message("The total number of rows in the array: " + MyVar.RowCount);
// Removes the last column
MyVar.RemoveColumn("LastColumn");
}
{
var MyVar;
MyVar = Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn("LastColumn");
// Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " + MyVar.ColumnCount);
Log.Message("The total number of rows in the array: " + MyVar.RowCount);
// Removes the last column
MyVar.RemoveColumn("LastColumn");
}
Python
def Test1():
MyVar = Project.Variables.MyTableVar
# Adds a new column to the array
MyVar.AddColumn("LastColumn")
# Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " + str(MyVar.ColumnCount))
Log.Message("The total number of rows in the array: " + str(MyVar.RowCount))
# Removes the last column
MyVar.RemoveColumn("LastColumn")
VBScript
Sub Test1
Set MyVar = Project.Variables.MyTableVar
' Adds a new column to the array
Call MyVar.AddColumn("LastColumn")
' Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " & MyVar.ColumnCount)
Log.Message("The total number of rows in the array: " & MyVar.RowCount)
' Removes the last column
Call MyVar.RemoveColumn("LastColumn")
End Sub
Set MyVar = Project.Variables.MyTableVar
' Adds a new column to the array
Call MyVar.AddColumn("LastColumn")
' Posts the total number of rows and columns in the array
Log.Message("The total number of columns in the array: " & MyVar.ColumnCount)
Log.Message("The total number of rows in the array: " & MyVar.RowCount)
' Removes the last column
Call MyVar.RemoveColumn("LastColumn")
End Sub
DelphiScript
procedure Test1;
var MyVar: OleVariant;
begin
MyVar := Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn('LastColumn');
// Posts the total number of rows and columns in the array
Log.Message('The total number of columns in the array: ' + VarToStr(MyVar.ColumnCount));
Log.Message('The total number of rows in the array: ' + VarToStr(MyVar.RowCount));
// Removes the last column
MyVar.RemoveColumn('LastColumn');
end;
var MyVar: OleVariant;
begin
MyVar := Project.Variables.MyTableVar;
// Adds a new column to the array
MyVar.AddColumn('LastColumn');
// Posts the total number of rows and columns in the array
Log.Message('The total number of columns in the array: ' + VarToStr(MyVar.ColumnCount));
Log.Message('The total number of rows in the array: ' + VarToStr(MyVar.RowCount));
// Removes the last column
MyVar.RemoveColumn('LastColumn');
end;
C++Script, C#Script
function Test1()
{
var MyVar;
MyVar = Project["Variables"]["MyTableVar"];
// Adds a new column to the array
MyVar["AddColumn"]("LastColumn");
// Posts the total number of rows and columns in the array
Log["Message"]("The total number of columns in the array: " + MyVar["ColumnCount"]);
Log["Message"]("The total number of rows in the array: " + MyVar["RowCount"]);
// Removes the last column
MyVar["RemoveColumn"]("LastColumn");
}
{
var MyVar;
MyVar = Project["Variables"]["MyTableVar"];
// Adds a new column to the array
MyVar["AddColumn"]("LastColumn");
// Posts the total number of rows and columns in the array
Log["Message"]("The total number of columns in the array: " + MyVar["ColumnCount"]);
Log["Message"]("The total number of rows in the array: " + MyVar["RowCount"]);
// Removes the last column
MyVar["RemoveColumn"]("LastColumn");
}
See Also
ColumnCount Property
Item Property
Iterator Property
Variables of the Table Type