GetRowCount Method
Description
Returns the total number of rows in the longest column in the first sheet in the design-time or run-time data table (global sheet).
Syntax
DataTable.GetRowCount
Return Value
Number
Example
The following example uses the GetRowCount method to find the total number of rows in the longest column of the MySheet run-time data sheet and writes it to the report.
rowcount = DataTable.GetSheet("MySheet").GetRowCount
Reporter.ReportEvent 2, "There are " &rowcount, "rows in the data sheet."
The example below performs the equivalent of renaming a column (parameter) in the DataTable by copying the data from one column to a new column with a new name, and then deleting the old column.
'add a new column
DataTable.GetSheet("Global").AddParameter "NewColumn","Row1Value"
'copy the cells from the old column into the new column
cnt=DataTable.GetRowCount
For i=1 to cnt
DataTable.SetCurrentRow(i)
OldVal=DataTable.Value("OldColumn","Global")
DataTable.Value("NewColumn","Global")=OldVal
Next
'delete the old column
DataTable.GetSheet("Global").DeleteParameter("OldColumn")