Monday, October 23, 2017

DataTable_Local Sheet Read Write and Export

'************************'Local data table*****************************

'To get the total rowCount  from Action1 Sheet


print datatable.GetSheet("Action1").GetRowCount
'*******************************************************
' Reading the data and wrting 

For i = 1 To datatable.GetSheet("Action1").GetRowCount Step 1
    datatable.GetSheet("Action1").SetCurrentRow(i)
    print datatable("Country","Action1")' read the data of Action1 of country column
    datatable("Test","Action1")=i 'Writes to the Action1 of Test Column
    ' in test column it will display 1,2,3,4.
Next
'wait 15

'*****************************************************
'Adding the column in Local Sheet
datatable.GetSheet("Action1").AddParameter "Col4","1234"
'if script complete column will be flashed out,see in test result window.
'wait 5

'*******************************************8
'Add own sheet in Datatable

datatable.AddSheet("TestData")                             ' Adding the Sheet to datattable
datatable.GetSheet("TestData").AddParameter "Test",""     'created a column in sheet "TEST
datatable.GetSheet("TestData").SetCurrentRow(5)            'writing in 5th column to the sheet TestData/Test
datatable("Test","TestData")="XXXXXXXX"                 'Writing data as XXXXXXX 
                                       
'******************************************************************
'Export complete datatble to xls file 2003
' in qtp only xls files are supported
' here old exported file will be deleted add new data will be appended


' to export complete datatable
datatable.Export "f:\qtp2.xls"
'to export particulat sheet from excel.
datatable.ExportSheet "f:\qtp2.xls","Action1"


                                       

No comments:

Post a Comment

Description Programming

'==Descriptive Programming language 'creating the common browser and page object  Set  myPage= browser( "creationtime:=0...