Tuesday, January 26, 2016

DataTable Methods and Properties in QTP/UFT:

AddSheet
Description: AddSheet method is used to add specified sheet to the run time datatable.
Syntax: DataTable.AddSheet(“Sheet_Name”)
Return Type: DTSheet Object
Example: DataTable.AddSheet(“Sheet_Name”)
----------------------------------------------------------------------
DeleteSheet
Description: DeleteSheet method is used to delete the specified sheet from the run time datatable.
Syntax: DataTable.DeleteSheet(“Sheet_Name OR SheetID”)
Example: DataTable.DeleteSheet(“Sheet_Name”)
DataTable.DeleteSheet(“Sheet_ID”)                                                ‘SheetID can be sheet name or index.
------------------------------------------------------------------------
Import
Description: Import method is used to import the excel file to the run time datatable.
Syntax: DataTable.Import(“File_Path”)
Example: DataTable.Import(“File_Path”)
-----------------------------------------------------------------------
ImportSheet
Description: Importsheet method is used to import a sheet to a specified sheet in the run time datatable.
Syntax: DataTable.Import(“File_Path”, Source_Sheet, Destination_Sheet)
Example: DataTable.Import(“File_Path”, Source_Sheet, Destination_Sheet)
---------------------------------------------------------------------
Export
Description: Export method is used to create and save a copy of runtime data table.
Syntax: DataTable.Export(“File_Path”)
Example: DataTable.Export(“File_Path”)
-----------------------------------------------------------------------
ExportSheet
Description: Exportsheet method is used to export a specified sheet of the run time datatable.
Syntax: DataTable.ExportSheet(“File_Path”, Destination_Sheet)
Example: DataTable.ExportSheet(“File_Path”, Destination_Sheet)
--------------------------------------------------------------------------
SetCurrentRow
Description: SetCurrentRow method is used to Set the specified row as current row in the run time datatable.
Syntax: DataTable.SetCurrentRow(Row_Number)
Example: DataTable.SetCurrentRow(5)
-----------------------------------------------------------------------------
SetNextRow
Description: SetNextRow method is used to set the next row as current row after the current row in the run time datatable.
Syntax: DataTable.SetNextRow
Example: DataTable.SetNextRow
---------------------------------------------------------------------------
SetPreviousRow
Description: SetPreviousRow method is used to set the previous row as current row in the run time datatable.
Syntax: DataTable.SetPreviousRow
Example: DataTable.SetPreviousRow
---------------------------------------------------------------------------
GetCurrentRow
Description: GetCurrentRow method is used to get the current row in the first sheet in the run time datatable.
Syntax: DataTable.GetCurrentRow
Return Type: Number
Example: Dim Row_Num
Row_Num = DataTable.GetCurrentRow
-----------------------------------------------------------------------------
GetRowCount
Description: GetRowCount method is used to get the row count in the first sheet in the run time datatable.
Syntax: DataTable.GetRowCount
Return Type: Number
Example: Dim Row_Count
Row_Count = DataTable.GetRowCount
-------------------------------------------------------------------------------
GetSheet
Description: GetSheet method is used to get the specified sheet from the run time datatable.
Syntax: DataTable.GetSheet(“Sheet_Name OR Sheet_ID”)
Example: DataTable.GetSheet(“Sheet_Name OR Sheet_ID”)
---------------------------------------------------------------------------------
GetSheetCount
Description: GetSheetCount method is used to get the Sheet count in the run time datatable.
Syntax: DataTable.GetSheetCount
Return Type: Number
Example:  Dim Sheet_Count

Sheet_Count = DataTable.GetSheetCount

No comments:

Post a Comment