Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How many ways we can use external XL sheet data import in to runtime datatable
#1
Not Solved
Hi All

Please help me to get data from external XLsheet to datatable (runtime) and use that data in to my applications

Code:
Using Datatable.getsheet

Dim rcount,i, Fdate, Cname, etc...

Datatable.AddSheet("Dtsheet")
datatable.importsheet("C\...\data.xls","sheet1","Dtsheet"

rcount = datatable.getsheet("Dtsheet").getrowcount

for i = 1 to rcount step 1

datatable.setcurrentrow(i)

Fdate = datatable.value("flydate","Dtsheet")
.
.
.
Cnmae = datatable.value("cname","Dtsheet")
,
,

window("flightReservation").active
window("flightReservation").ActiveX("MaskEdBox").type "Fdate"
...
..
Some one please explain the complete flow please

How the data entering in to the (run time) datatable

When the data assigned to variables, how the data input to the application and all other ways to do this with different ways.

Some time working and some time don't work.

I would like to know which way and How many ways we can use external XL sheet data import in to runtime datatable and how we can use that data for Application test data.

Please give some brief description along with example code please.

It should be really appreciated your effort and thanks in advance

Cheers
Reply
#2
Not Solved
Hi govQa,

You just forgot couple of points in your example.

1)Instead of datatable.setcurrentrow(i) ...... give Datatable.GetSheet("Dtsheet").SetCurrentRow(i) as shown below.
2) FYI..If you are running the script using the Getrowcount thru For Loop...then in File --> Settings -->Run Tab , Select "Run On One Iteration" RadioButton --> Apply -->OK.

Now Try to Execute the code given below & see.....

Example:
Code:
Dim rcount,i, Fdate, Cname, etc...

Datatable.AddSheet("Dtsheet")
datatable.importsheet("C\...\data.xls","sheet1","Dtsheet")

rcount = datatable.getsheet("Dtsheet").getrowcount

for i = 1 to rcount
datatable.Datatable.GetSheet("Dtsheet").SetCurrentRow(i)
Fdate = datatable.value("flydate","Dtsheet")
.
.
.
Cnmae = datatable.value("cname","Dtsheet")
,
,

window("flightReservation").active
window("flightReservation").ActiveX("MaskEdBox").type "Fdate"
...
..
Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Search and import data from excel under some rules. nwpulele 2 2,970 02-19-2015, 04:10 AM
Last Post: supputuri
  Exporting QTP runtime datatable to SQL server during SweetyChowdhury 1 3,291 05-10-2013, 03:41 AM
Last Post: sria123
  data sheet row count rushil 2 7,691 12-07-2012, 03:10 AM
Last Post: rushil
  Does QTP support writing runtime data to multiple sheets in excel Shwethareddy 2 3,709 10-16-2012, 12:20 PM
Last Post: Shwethareddy
  Coloring cell of runtime datatable indranilgoswamimcb 3 11,058 08-03-2012, 03:51 PM
Last Post: SteveS

Forum Jump:


Users browsing this thread: 1 Guest(s)