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

Answers were Sorted based on User's Feedback



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

Answer / nani

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

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

Answer / kalyan

Nani you are right. If u explain these methods with
examples it wil very use ful 4 beginenrs.

Thanks & Regards,
Kalyan

Is This Answer Correct ?    7 Yes 0 No

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

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

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

Answer / mohammad

data table methods works with excell sheet only

Is This Answer Correct ?    6 Yes 6 No

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

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

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

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

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

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

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

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

Post New Answer

More QTP Interview Questions

i have .xls,.txt,.doc files are there (together). i want find only .xls file among them? how can we write function?

3 Answers   CTS,


Why divide a test into three action calls?

1 Answers  


How to handle the exceptions using the recovery scenario manager in qtp?

0 Answers  


A web page has two butons with same properties and rotating in clockwise direction. how to click on any of the button?

2 Answers   Virtusa,


Hi, Has anybody attended IBM interview on 17th APR 2010,and got offer letter? I had given interview and selected also but still did not recieve offer letter.

5 Answers   IBM,






how do we know whether all objects are stored in the object repository or not? how can we know if a particular object is not stored in the repository?

0 Answers  


Hello Everybody, Please tell me the concept of recovery management in QTP by giving any practical example of it. Thanks, Gaytri

7 Answers  


What does ".mst" stands for? (abc.mst)

3 Answers   Infosys,


Write a script to customize the test results in PDF and HTML format.

0 Answers   DuPont,


How can i open 5 multiple browser at once through QTP VB script and i want to login with 5 different credentials i already tried with this code but its entering credentials only for first browser and am using datatable to parameterize

2 Answers  


suppose there r 10 action in a test i want to execute action 5 to 10 how would i do that

2 Answers  


what is frame work?

2 Answers   Wipro,


Categories