QTP - Data Table Object Methods
Advertisements
Method Name | Description | Syntax |
---|---|---|
AddSheet | Adds the specified sheet to the run-time data table | DataTable.AddSheet (SheetName) |
DeleteSheet | Deletes the specified sheet from the run-time data table | DataTable.DeleteSheet SheetID |
Export | Exports the Datatable to a new file in the specified location | DataTable.Export(FileName) |
ExportSheet | Exports a Specific Sheet of the Datatable in run-time | DataTable.ExportSheet (FileName,SheetName) |
GetCurrentRow | Returns the active row of the run-time data table of global sheet | DataTable.GetCurrentRow |
GetParameterCount | Returns the number of columns in the run-time data Table of Global Sheet | DataTable.GetParameterCount |
GetRowCount | Returns the number of rows in the run-time data table of Global Sheet | DataTable.GetRowCount |
GetSheet | Returns the specified sheet from the run-time data table. | DataTable.GetSheet(SheetID) |
GetSheetCount | Returns the total number of sheets in the run-time data table. | DataTable.GetSheetCount |
Import | Imports a specific external Excel file to the run-time data table. | DataTable.Import(FileName) |
ImportSheet | Imports the specified sheet of the specific excel file to the destination sheet. | DataTable.ImportSheet(FileName, SheetSource, SheetDest) |
SetCurrentRow | Sets the Focus of the Current row to the Specified Row Number | DataTable.SetCurrentRow (RowNumber) |
SetNextRow | Sets the focus of the next row in the run-time data table | DataTable.SetNextRow |
SetPreviousRow | Sets the focus of the previous row in the run-time data Table | DataTable.SetPrevRow |
DataTable Object Properties
Property Name | Description | Syntax |
---|---|---|
GlobalSheet | Returns the first sheet of the run-time data table. | DataTable.GlobalSheet |
LocalSheet | Returns the Active local sheet of the run-time data table. | DataTable.LocalSheet |
RawValue | Retrieves the raw value of the cell | DataTable.RawValue ParameterID, [SheetID] |
Value | Retrieves the value of the cell in the specified parameter. | DataTable.Value(ParameterID, [SheetID]) |
Example
Consider the following DataTable −
'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