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

hai there..this is chandu..i have a txt file which containing 1000 lines but at a time i want to retrieve 50 lines..after 50 lines i required to retrieve 51-100..like that i want...so could anybody help me in this...thanks in Advance..

3 Answers  


what is output value in QTP and how it can be used in automation testing

0 Answers  


How we can add objects to the object repository during the running?is it possible or not?explain

3 Answers  


How to compare the two strings?

2 Answers  


1. How to capture data from images in QTP and produce them in Excel sheet

1 Answers   Broadridge,






How to return a value from a fn, if it has more than one value how to return

3 Answers   Verizon,


Hi.. I want to do parametrization for selecting perticular flighr say XYZ by using local table: criteria: 1.If flight is available msgbox "Flight is available" and then select flight from flight table and click to ok button after that as enter username and ticket no and then stop 2. otherwise msgbox " Flight is not available" and stop Please help me out ..and let me know your responses on dipak.bachhav@gmail.com Regard, Dipak

0 Answers  


What are advantages of test automation?

0 Answers  


Hi All Below is my script which i made for lgin into Flight.exe. SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open" Dialog("Login").WinEdit("Agent Name:").Set DataTable ("p_Text", dtGlobalSheet) Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure DataTable ("p_Text1", dtGlobalSheet) Dialog("Login").WinButton("OK").Click If Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").Click datatable.Value(3)= "Incorrect password. Please try again" Dialog("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)="Please enter agent name" Dialog ("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)= "Please enter password" Dialog("Login").WinButton ("CANCEL").Click else Window("Flight Reservation").Move 309,146 datatable.ExportSheet "C:\Raj\Result.xls" ,1 Window("Flight Reservation").Close End If I want to capture the Message string from Dialog("Login").Dialog("Flight Reservations" Also pls let me know if this is the right way to do the script for login. Pls provide some script for login Flight.exe Thanks in advance Raj Dhiman

1 Answers  


What is difference between design time and run time data table?

0 Answers  


how will we run batch tests in qtp what is the process to run the multiple test sets?

3 Answers  


Hi guys pls any one send me the Qtp Licensed key of version 10.0 pls

0 Answers  


Categories