QTP - DTSheet Methods


DTSheet Methods:

Method NameDescriptionSyntax
AddParameterAdds the specified column to the sheet in the run-time data table.DTSheet.AddParameter(ParameterName, Value)
DeleteParameterDeletes the specified parameter from the run-time data table.DTSheet.DeleteParameter(ParameterID)
GetCurrentRowReturns the row number of the active row in the run-time Data Table.DTSheet.GetCurrentRow
GetParameterReturns the specified parameter from the run-time Data Table.DTSheet.GetParameter(ParameterID)
GetParameterCountReturns the total number of Columns in the run-time Data Table.DTSheet.GetParameterCount
GetRowCountReturns the total number of rows in the run-time Data Table.DTSheet.GetRowCount
SetCurrentRowSets the Focus on the specified Row of the Data TableDTSheet.SetCurrentRow(RowNumber)
SetNextRowShifts the Focus to the next Row of the Data Table.DTSheet.SetNextRow
SetPrevRowShifts the Focus to the Previous Row of the Data Table.DTSheet.SetPrevRow


  '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
  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