Friday, 24 July 2015

DATATABLE METHODS

 
Data table methods:
          Data table methods are used for performing the operations on the runtime data table

1. Add- sheet: It is used for adding the new sheet for the runtime data table
                    SYNTAX: Data table.addsheet”sheet name”
2.Delete- sheet: It is used for deleting a specified sheet from the run time data table
                    SYNTAX: Data table.deletesheet”sheet name”
3. Import: It is used for importing the data present in all the sheets in an excel file to the runtime data table
                    SYNTAX: Data table.import ”path of the excel file”
4. Import Sheet: It is used for importing specified sheet of data from the excel file to the specified sheet in the runtime data table
SYNTAX: Data table. Import sheet “path of the excel file, source sheet id, destination sheet id”
                            
5.Export: It is used for exporting the complete data present in the run time data table to a specified location
                    SYNTAX: Data table. export “Path of the location with a file name.xls extension

6.Export Sheet: It is used for exporting the data present in a specified sheet in the run time data table to a specified location
SYNTAX: Data table .export sheet “path of the location with a file name.xls extension”, sheet id to be exported.


7.Set currant row: It is used for making the QTP focus on a specified row
                    SYNTAX: Data table. Set currant row (row number)

8.Set next row: It is used for making the QTP focused on the next of the currently focused row
                    SYNTAX: Data table. Set next row

9.SetPrev Row: It is used for making the QTP focus on the previous row of the currently focused tow
                    SYNTAX: Data table. Set prev row

10. Value Method: It is used for getting a value from a specified sheet, specified column and currently focused row.
                    SYNTAX: Variable= Data Table. Value ( “column name”, sheet id)

11. Get Sheet: It is used for making the QTP to focus on a specified sheet
                    SYNTAX: Data table. Get sheet (sheet id)

12Get Row Count: It is used for getting the row count of a global sheet
If at all one wants to get the row count of a specified sheet first of all they need to make the QTP to focus on a specified sheet and then get the row count

                    SYNTAX 1: Variable= Data Table. Get row count
                    SYNTAX 2: Variable= Data Table. Get sheet (“sheet id”). Get row count


Example:
                    Data table.Addsheet“ Sri”
                    Data table.import sheet “e:\Sri\td122.xls,1,3
                    N=Data table.getsheet( 3).getrowcount
                    For i= 1 to n
                   Data table. Set currant row( i )
                    Vbwindow(“form1”).vbedit(“val1”).set data table(“v1”,3)
                    Vbwindow(“form1).vbedit(‘val2’).set data table(“v2”,3)
                    Vbwindow(”form1”).vbbutton(“add”).click
                    Expval= data table.value(“ev”,3)
                    Act val= vbwindow(“form1”).vbedit(“res”).getroproperty(“text”)
                    If (expval= act val) then
                    Data table (“res”,3)= “pass”
                    Else
                    Data table (“res”,3)= “fail”
                    End if
                    Next
                    Data table.export sheet “D;\fl_automation\log\file2.xls”,3
                    Data table.delete ‘Sri”



No comments:

Post a Comment