Wher to use DATA TABLE METHODS in Qtp?What is the use of it?
Answers were Sorted based on User's Feedback
Hi,
Generally data table methods can use in run time.
wn ever we need data in run time then we can use data table
methods.
All methods performed on this object apply to the run-time
DataTable object only. Changes to the run-time DataTable
object are reflected in the test results, but the design-
time Data Table is not affected.
different data table methods are:
AddSheet Method
DeleteSheet Method
Export Method
ExportSheet Method
GetCurrentRow Method
GetRowCount Method
GetSheet Method
GetSheetCount Method
Import Method
SetCurrentRow Method
SetNextRow Method
Is This Answer Correct ? | 25 Yes | 1 No |
Answer / 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 |
Answer / mohammad
data table methods works with excell sheet only
Is This Answer Correct ? | 6 Yes | 6 No |
Answer / yogesh basediya
DataTable("A",1)=77
or
DataTable("A",Global)=99
For Local
DataTable("A",2)=77
or
DataTable("A","Action1")=99
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / vasu
Hi Gautham, yes the "general error" will come when u use
Excel 2007. dont use it. use the excel versions of Excel 97
to 2003 versions. Then the path will work fine.
vasuseven@gmail.com (IBM)
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / k.chandra sekhar
a) In QTP data table window is used to store the test
data, and parameterization that data to the test during
execution.
b) While go for out put values and data driven test
then use the data table window
c) The data table window mainly has the two types of
windows. They are
d) Global data table window
e) Action data table window
f) The global data table window is used for public
purpose, it default data table
g) Action data table window is used for local purpose,
it private purpose
My name is k.chandra sekhar,
My phone no is 09246540049,
Hyderabad.
My mail id is ndra_143@yahoo.co.in
If any body want full explain send the mail
Is This Answer Correct ? | 5 Yes | 7 No |
Answer / gautham
When I tried this, I am getting an error:
A general error occurred while importing file F:\world.xls.
Line (1): "DataTable.Import ("F:\world.xls")".
Why is it coming? Path is corretc.
Is This Answer Correct ? | 0 Yes | 3 No |
Could anyone please tell me one situation where you have used recovery scenarion in real time with an example?
what time u r using data driven test in ur app"
what is the exact Diff. Between Test and Component in QTP?
Hi Friends, How many types of Data Bases available in market... What is the diff. while using Syabase and Oracle in a Project... ? and what is the main diff. of Syabase and Oracle databases... ? Thanx in advance..
whenever U using QTP,Test Director, Why we using separate Bug tracking tool?
Hi all Can u give me the link where we can download full version of qtp my mail id is karthic.venkitapathi@gmail.com
What is the difference in the global and action sheet in qtp?
what is the use of Browser.sync()
what is selective recording ? and normal recording?
what is keyword driven framework in qtp.
How to record object in runtime. I am testing one Image website in which every time image change on home page.so if i records the image list but during running image get change, and QTP gives error
how to parameterise a test with data base table or excel sheet?