QTP - DTSheet Methods



Method Name Description Syntax
AddParameter Adds the specified column to the sheet in the run-time data table. DTSheet.AddParameter (ParameterName, Value)
DeleteParameter Deletes the specified parameter from the run-time data table. DTSheet.DeleteParameter (ParameterID)
GetCurrentRow Returns the row number of the active row in the run-time Data Table. DTSheet.GetCurrentRow
GetParameter Returns the specified parameter from the run-time Data Table. DTSheet.GetParameter (ParameterID)
GetParameterCount Returns the total number of Columns in the run-time Data Table. DTSheet.GetParameterCount
GetRowCount Returns the total number of rows in the run-time Data Table. DTSheet.GetRowCount
SetCurrentRow Sets the Focus on the specified Row of the Data Table DTSheet.SetCurrentRow (RowNumber)
SetNextRow Shifts the Focus to the next Row of the Data Table. DTSheet.SetNextRow
SetPrevRow Shifts the Focus to the Previous Row of the Data Table. DTSheet.SetPrevRow

Example

'Accessing Datatable to get Row Count and Column Count
rowcount = DataTable.GetSheet("Global").GetRowCount
msgbox rowcount      ' Displays 4
  
colcount = DataTable.GetSheet("Global").GetParameterCount
msgbox colcount		 ' Displays 3
  
DataTable.SetCurrentRow(2) 
val_rate = DataTable.Value("Rate","Global")
print val_rate   ' Displays 7%
  
val_ppl = DataTable.Value("Principal","Global")
print val_ppl	 ' Displays 2556
  
val_Time = DataTable.Value("Time","Global")
print val_Time	 ' Displays 5
qtp_datatables.htm
Advertisements