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 |
write a vb script to print even numbers from 1-50?
6 Answers Kclink Technologies, Logica CMG,
Suppose if a functionalityis not mensioned in requirement document and but its present in application. will it be consider as a bug and viceversa?
Anybody can tell me what are the common roles and responsibilites of a Automation Test engineer
How many test scripts are prapare in ur project(HeathCare Insurance).
actually how many hours per one day we will work on automation(qtp) in real time
What VBScript operators, functions, and statements do you use in QuickTest Professional?
HI. Plz Clarifie my doubt,having 2+yrs experience in Testing , But My accedamics(Xth,INTER) are Less than 60%, But B.Tech 72%. It creats any problem , When i change to any MNC. plz tell me......... lot of friends told it's a problem, Some people says NO problem, What .............
How to change the screen name while running the test.
Is there a function to find the number of occurrences of sub strings within a string?
DIFFERENT RUN MODE IN QTP..1-VERIFY MODE 2-UPDATE MODE 3- dEBUG MODE. My question is in whic sitution we use these modes Explain me with example
Hi! Using Descriptive Programming How do we get Parent object for an object by writing script(DP). Say, i want to get a parent object for a "Link" in a web page by writing script in Descriptive Programming.
How to use descriptive programming?