Pages

Custom Search

QTP Data Table Methods

QTP Data Table Methods
(1) Add Sheet:
We can use this method to "add" one new sheet to the run time data table.
Syntax: DataTable.AddSheet "sheet name"
Ex: DataTable.AddSheet "gcreddy"

(2) Delete Sheet:

We can use this method to "delete" one specified sheet from the Run Time Data table.


Syntax: datatable.DeleteSheet (Sheet_ID)
Ex: datatable.DeleteSheet (3)


(3) GetSheetCount


We can use this method to count number of sheets in the run time data table.


Syntax:
datatable.GetSheetCount
msgbox datatable.GetSheetCount

(4) GetRowCount


We can use this method to count number of rows in the 1st sheet
(longest column) of the Run time data table.


Syntax: datatable.GetRowCount


Ex: msgbox datatable.GetRowCount

(5) GetSheet


We can use this method to return a specified sheet from the Run Time data table.


Syntax: datatable.GetSheet(SheetID)


Ex: msgbox datatable. GetSheet(1).GetRowCount


(6) Value

We can use this method to set or get value of cell in the specified parameter and the current row of the Rum time data table.


To set data


Syntax: datatable.Value(Parameter_Name, Sheet_Name) = Value / variable Or

datatable(Parameter_Name, Sheet_Name) = Value / variable


To get data

Syntax: Variable = datatable.Value(Parameter_Name, Sheet_Name) Or

Variable = datatable(Parameter_Name, Sheet_Name)


Ex:

Option explicit Dim a, b, c


a=datatable.Value (1,1) b=datatable.Value (2,1) c=cint(a)+cint(b) datatable.Value (3,1) = c

Note: Default property of Datatable is value

(7) SetCurrentRow


We can use this method to take a specified row as current row in the Run Time Datatable (By default it is 1st Row of 1st Sheet)

Syntax: datatable.SetCurrentRow(Row_Number)

g="gcreddy"

datatable.SetCurrentRow (3) datatable.Value (1,1) = g


(8) SetNextRow


We can use this method to take the row after the current Row as New Current Row in the Run time data table.


Syntax: datatable.SetNextRow

Ex: g="gcreddy"

datatable.SetCurrentRow (3) datatable.SetNextRow datatable.Value (1,1) = g


(9) SetPrevRow

We can use this method to take the row before the current Row as New Current Row in the Run time data table.


Syntax: datatable.SetPrevRow


Ex: g="gcreddy"


datatable.SetCurrentRow (3) datatable.SetPrevRow datatable.Value (1,1) = s


(10) Import

We can use this method to import Microsoft Excel File to the Runtime Data Table (Including all sheets)


Syntax: datatable.Import "Path of File"

Ex: datatable.Import "F:\Inputdata.xls"

11) ImportSheet

We can use this method to import a specified sheet of Microsoft Excel Sheet to the Runtime Data table.


Syntax: datatable.ImportSheet "Path of File", "Source Sheet", "Destination Sheet"

Ex: datatable.ImportSheet "E:\gcreddy.xls",3,1

(12) Export


We can use this method to export a copy of Run Time Data table to another location (Including all sheets)


Syntax: datatable.Export "Path of File"


Ex: datatable.Export "F:\gcreddy.xls"


13) ExportSheet


We can use this method to export a copy specified sheet of Run Time Data table to the existing or new Excel File.

Syntax: datatable.ExportSheet "Path of File", "Sheet Name / Source Sheet"


Ex: datatable.ExportSheet "F:\gcreddy.xls", 2

**********************
Data Driven Testing for Login Operation using Data Table methods

Datatable.AddSheet "Login"
Datatable.ImportSheet "C:\Documents and Settings\gcr\Desktop\gcreddy.xls",1,3
Rows_count=Datatable.GetSheet(3).GetRowCount

For i= 1 to Rows_count
    Datatable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set Datatable("Agent",3)
Dialog("Login").WinEdit("Password:").Set Datatable("Pwd",3)
Dialog("Login").WinButton("OK").Click

If window("Flight Reservation").exist(10) Then
    Login="Login Operation Successful"
    Datatable("Result",3)=Login
    Reporter.ReportEvent micPass,"res","Passed"
    else
Reporter.ReportEvent micFail,"res","Failed"
Login="Login Operation Failed"
Datatable("Result",3)=Login

Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If

If Window("Flight Reservation").Exist(3)Then
    Window("Flight Reservation").Close
    End if
Next

10 comments:

Anonymous said...

Very good blog! Do you have any helpful hints for aspiring writers?

I'm hoping to start my own website soon but I'm a little lost on everything.
Would you recommend starting with a free platform like Wordpress or go for a paid option?
There are so many choices out there that I'm totally overwhelmed .. Any recommendations? Bless you!

Feel free to visit my website; www.irmaosfranciosi.com.br

Anonymous said...

Based on my research, after a in foreclosure process home is available
at a sale, it is common for your borrower in
order to still have a remaining balance on the mortgage.
There are many loan providers who seek to have all charges and liens
paid back by the next buyer. However, depending on ecified programs, rules,
and state legal guidelines there may be many
loans that aren't easily resolved through the transfer of loans. Therefore, the duty still falls on the borrower that has acquired his or her property foreclosed on. Many thanks for sharing your opinions on this site.

My webpage: face book of sex

Anonymous said...

Magnificent beat ! I wish to apprentice while you amend your web site, how can i
subscribe for a blog website? The account aided me a acceptable deal.
I had been tiny bit acquainted of this your broadcast offered bright clear idea

Also visit my web-site :: face book of sex

Anonymous said...

A lot of thanks for all your valuable labor on this blog.
Kate takes pleasure in managing investigation and
it's really easy to understand why. My partner and i learn all regarding the dynamic mode you render effective tips through your web blog and cause contribution from other individuals on this concept so my girl is really being taught a whole lot. Take pleasure in the rest of the year. You have been doing a splendid job.

Also visit my web blog - onl ine dating

Anonymous said...

You made some first rate points there. I appeared on the internet for the difficulty and located
most individuals will go along with with your website.


my web-site :: date sites for free online

Anonymous said...

What�s Happening i am new to this, I stumbled upon this I've found It absolutely helpful and it has helped me out loads. I hope to contribute & aid other users like its helped me. Good job.

Here is my website ... facebookofsex

Anonymous said...

Thank you for another great article. The place else may just anybody get
that kind of information in such a perfect way of writing?
I have a presentation subsequent week, and I'm at the search for such information.

My web site vedharma.de

Anonymous said...

Thanks for the concepts you are revealing on this blog site.
Another thing I'd really like to say is that getting hold of of your credit score in order to inspect accuracy of each and every detail will be the first activity you have to execute in credit repair. You are looking to clear your credit file from dangerous details flaws that wreck your credit score.

Also visit my page http://www.ceconsult.hu/

Anonymous said...

Another thing I have noticed is that often for many
people, bad credit is the reaction to circumstances over and above their control.
By way of example they may have already been saddled having an illness so that they have substantial bills for collections.
It would be due to a occupation loss or perhaps the inability
to do the job. Sometimes divorce process can truly send
the funds in the undesired direction. Many thanks sharing
your ideas on this website.

Feel free to surf to my weblog - gratis dating online

Anonymous said...

We are a bunch of volunteers and starting a new scheme in our community.
Your website offered us with valuable info to work on.
You have performed an impressive process and our whole community will
be thankful to you.

my web-site: facebook sex