Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18488 Posts in 4838 Topics- by 32654 Members - Latest Member: revitvm
 

AdvancedQTP forums have been nominated as a finalist in ATI’s 2nd annual automation honors awards!

We’d like to thank you for your continued support and participation, and urge you to hurry and vote.

Make you voice count! 


Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Data table/Parameterization    (Read 1009 times)
Srikanth Reddy
FRProject
User
*
Offline Offline

Posts: 10


WWW
« on: February 13, 2008, 04:46:58 AM »

How to create a data table and use it in the script?How to link it to the current test? Huh?
Logged
praveen kumar
User
*
Offline Offline

Posts: 33


« Reply #1 on: February 13, 2008, 08:14:45 AM »

this does not answer ur question directly, but should help u considerably:
option explicit

Dim global
Dim strmaster, strprime
Dim m,p,i
Dim pth
strmaster = empty
strprime = empty

pth = "c:\AgentCodes.xls"
datatable.ImportSheet "c:\ExceptionStates.xls","Apple States",global
datatable.AddSheet ("master agent")
datatable.AddSheet("prime agent")


datatable.ImportSheet pth,"master agent","master agent"   'look help to understand more
datatable.ImportSheet pth,"prime agent","prime agent"
m = datatable.GetSheet("master agent").setcurrentrow(1)
p = datatable.GetSheet("prime agent").setcurrentrow(1)

datatable.SetCurrentRow (1)
'msgbox "  master: " & m & "  prime: "& p
For m = 1 to datatable.GetSheet("master agent").getrowcount
   strmaster = strmaster & datatable.value("master","master agent") & vbcrlf
   datatable.getsheet("master agent").setnextrow
Next
For p = 1 to datatable.GetSheet("prime agent").getrowcount
   strprime = strprime & datatable.Value("prime","prime agent") & vbcrlf
   datatable.GetSheet("prime agent").setnextrow
Next

msgbox "contents of master agent xl sheet "& vbcrlf & strmaster &vbcrlf &" total rows: "& datatable.GetSheet("master agent").getrowcount
msgbox "contents of prime agent xl sheet " &vbcrlf & strprime & vbcrlf & " total rows: " & datatable.GetSheet("prime agent").getrowcount

PS: if u want to increment the row count of global sheet, use datatable.getsheet("global").setnextrow
Logged

praveen kumar
Meir Bar-Tal
Administrator
Advanced User
*****
Offline Offline

Posts: 1285



WWW
« Reply #2 on: February 13, 2008, 11:51:23 AM »

I wish to add:

1) The Global sheet is the default sheet of the DataTable Object, so it isn't needed to use GetSheet for the Global sheet.

2) It is accustomed to use the constants dtGlobalSheet and dtLocalSheet to refer to the Global sheet and the sheet attached to the current action.

I hope this is useful.

Good Luck! Smiley
Logged

Best Regards,

Meir Bar-Tal
AdvancedQTP Chief Editor & Forums Administrator
praveen kumar
User
*
Offline Offline

Posts: 33


« Reply #3 on: February 13, 2008, 06:05:04 PM »

hi meir,
this is what i have observed:
when i am working with multiple data sheets, the one on which the most recent operation is done, becomes the current one.
taking my below example, if say datatable.getsheet("master agent").getcurrentrow, retrieve a couple of values & then say datatable.setnextrow, next row for "master agent" data table gets set, but NOT for global data sheet. hence, i specifically used, datatable.getsheet("global").setnextrow. this is guranteed to work..
also, i seldom got dtGlobalSheet & dtLocalSheet work to my needs... hence, i don't use them much...
please let me know if you have a different point of view.
Logged

praveen kumar
Meir Bar-Tal
Administrator
Advanced User
*****
Offline Offline

Posts: 1285



WWW
« Reply #4 on: February 14, 2008, 12:30:18 AM »

Fine. I wanted to add, not argue with you. Smiley
Logged

Best Regards,

Meir Bar-Tal
AdvancedQTP Chief Editor & Forums Administrator
Srikanth Reddy
FRProject
User
*
Offline Offline

Posts: 10


WWW
« Reply #5 on: February 14, 2008, 12:34:50 AM »

thanks a lot praveen and Meir.this helped me a lot.
Logged
Pages: [1]   Go Up
Print
Jump to: