Wher to use DATA TABLE METHODS in Qtp?What is the use of it?

Answer Posted / sailaja

Just add-in of Nani Ans..Upto my knwz we can use functions
lik this

''To import xlsheet from desktop to datatable
datatable.Import("C:\Documents and
Settings\Raju\Desktop\seshu1.xls")
'
''From datatable to where we went to export tht we can
specify
datatable.Export("C:\Documents and
Settings\Raju\Desktop\test1.xls")
''
''If we wnt to add the sheet in datatable
a=DataTable.AddSheet ("Test").AddParameter("QTP", "Welcome
QTP")
msgbox a
'
''here 1 indicates "global sheet" & 2 indicates "action 1"
datatable.ExportSheet"C:\Documents and
Settings\Raju\Desktop\test2.xls", 2

'add the sheet in datatable &want to delete particular sheet
b=DataTable.AddSheet ("Test5").AddParameter("QTP", "Welcome
QTP")
msgbox b
datatable.DeleteSheet "Test5"

'add the sheet in data table & enter the xlsheet data into
the sheet
c=DataTable.AddSheet ("Test3").AddParameter("QTP", "Welcome
Test")
msgbox c
DataTable.ImportSheet"C:\Documents and
Settings\Raju\Desktop\test.xls", 1, 3

'add the sheet in data table & get the that sheet
d=DataTable.AddSheet ("Test3").AddParameter("QTP", "Welcome
Test")
msgbox d
DataTable.GetSheet ("Test3").AddParameter "Name", "Sailaja"

'add the sheets & count the no of sheets by including
global & action1 sheets also.
e=DataTable.AddSheet ("Test4").AddParameter("QTP", "Welcome
raju")
msgbox e
f=DataTable.AddSheet ("Test3").AddParameter("QTP", "Welcome
Test")
msgbox f
g= DataTable.GetSheetCount
msgbox g

'import the sheet into the datatable & identify the row
c=DataTable.AddSheet ("Test3").AddParameter("QTP", "Welcome
Test")
msgbox c
DataTable.ImportSheet"C:\Documents and
Settings\Raju\Desktop\test.xls", 1, 3
row = DataTable.GetCurrentRow
msgbox row
'
'add the sheet, get the no of rows in tht sheet
c=DataTable.AddSheet ("Test3").AddParameter("QTP", "Welcome
Test")
msgbox c
rowcount = DataTable.GetSheet("Test3").GetRowCount
msgbox rowcount
c1=DataTable.AddSheet ("Test3").AddParameter
("QTP1", "welcome test 1")
msgbox c1
rowcount1 = DataTable.GetSheet("Test3").GetrowCount
msgbox rowcount1



'How to import xlsheet in datatable & count in data table,
how to read line by line


Dim a,n,m,i
datatable.Import("C:\Documents and
Settings\Sailaja\Desktop\sailu.xls")
n=datatable.GetRowCount
msgbox n
For i=1 to n
datatable.SetCurrentRow(i)
m=datatable.Value("sailu", 1)
msgbox m
datatable.SetNextRow
Next




'How to get open xlsheet, count sheets& how to read data
line by line

Dim excel,workbook,DriverSheet,n,rowcount,fieldvalue,i,j
set excel=createobject("excel.application")
excel.visible=true

set workbook= excel.workbooks.open("C:\Documents and
Settings\Sailaja\Desktop\sailu.xls")
Set DriverSheet = Workbook.Worksheets("Sheet1")
n = DriverSheet.usedrange.columns.count
rowcount = DriverSheet.usedrange.rows.count
msgbox n
msgbox rowcount
For i = 1 to n
columnname = Driversheet.cells(i,1)
If columnname=columnname Then
For j = 1 to rowcount
fieldvalue = DriverSheet.cells(j,i)
msgbox fieldvalue
next
end if
next

Dim v,n
datatable.Import("C:\Documents and
Settings\Raju\Desktop\seshu1.xls")
n=datatable.GetRowCount
msgbox n
For i=1 to n
datatable.SetCurrentRow(i)
a=DataTable.Value(i)
msgbox a
j=datatable.SetNextRow
msgbox j
next

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to interact tool & application build in QTP?

1555


What is the difference between call to existing action and copy of an action?

684


What is the new version of qtp which is recently released in the market?

722


What is the extension of the recovery scenario file in qtp?

632


What is action split and the purpose of using this in qtp?

623






How to Get the Run-time value of an object under that web app under Test to the local data table sheet of that Action?

3808


What is the difference between a Function and Action in QTP?

701


How many types of recording modes in the qtp?

690


Suppose you are using shared objects repository in your test and you want to split your present action? At that time shared object repository is single or it’s also splits?

758


Presently i am working on QTP 8.2 Version,i want to know features in 9.2 version, because i have not sufficient time to put the effort on the 9.2 version

1491


What test you perform mostly? Regression or retesting in your testing process?

663


Object repositories types, which and when to use?

692


Discuss quicktest professional (qtp) environment?

665


What are the check points can be inserted without recording?

693


i have asked earlier only one question how to test web application using QTp plz send me the answer quickly

1752