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 will internal and external links be validated and updated? how often?

655


Pls can anybody send me the Recent Technical and Interview Questions Which were asked in IBM(QTP)Automation PLZZZZZZZZZ

1551


What environment does qtp run in?

638


Hoe can we do retesting using functions please give the code for it using login page

1578


Hi All, How to Compare two strings character by character in QTP

971






what could go wrong with test automation?

1526


What is the default object synchronization timeout in qtp?

666


Tell me one scenario, the complex functionality you have automated in your project?

1496


Pls can anyone give me the entire code for the Keyword driven framework with respect to he Flight Reservation Window in detail with explanation. Pls explain in detail stepwise. Thanks a lot. Pls very urgent?.

1535


images are dynamically changes how to compare two images with out using the bitmap

2017


Write the script to delete the mail which is at 9th,13th and 18th place in INBOX of Gmail ?

1694


Can anyone pls tell me how to do action parameterization (input and output parameters) with respect to login window and insert order of flight reservation window in detail( pls give a clear step by step explanation with example) anyone please. Will be very thankful to u

1393


banking domain description for software tester for interview

3482


Hi we are using QTP9.0 for Seibel Application and this seibel application will give you a popup messagebox which is of web , so qtp takes 3 mins to recognize the messagebox and to click on it , we have more number of messageboxes like this . please suggest me some solution

1685


how can i pass a "automation script" as a parameter in a function give me need full suggestion thank inadvance

1440