Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding rows to the DataTable
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hello,
I cannot seem to add rows to my Datatable. I am capturing transaction times using the MercuryTimers function then I save the first value along with the column name using the Addparameter function. This all works fine, but I do many iterations and I want to populate the rows of the existing columns not keep adding more columns. Is there a way to do this?

Code:
DataTable.GetSheet("Action1")
DataTable.SetCurrentRow(intIteration)
' here i need something other than addparameter if iteration > 1
DataTable.LocalSheet.AddParameter "LoginPage", loginpageTime
Wend
DataTable.ExportSheet "C:\Automation Data\data\SingleUser.xls", 2
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
I found one answer here I will try, my search criteria was not so good Big Grin
https://www.learnqtp.com/forums/add-a-ro...-1461.html
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Code:
p=datatable.AddSheet ("My").AddParameter("city","New York")

i=datatable.GetSheet ("My").getcurrentrow
msgbox i 'This will give 1 as the current row is 1.

q=datatable.GetSheet ("My").SetNextRow 'This one is getting null value.It should show 2
'but nothing
msgbox q

datatable.getsheet("My").Setcurrentrow(2) 'then i've used this cuz i know my current
'row index is 2
'******** Both code below worked for adding value in run time data sheet.
'datatable.Value("city",3)="Bombay"   '3 is for sheet index  for Sheet name My
Datatable.Getsheet("My").GetParameter("city").Value="Bombay"

Data=datatable("city",3)'getting  current row value from sheet My index 3
msgbox Data
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
the idea was to load columns that match the raw data from loadrunner that I am gathering so I could extrapolate the page rendering time rather than having to cut rows and paste them into columns manually. the following solution worked:
Code:
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Workbooks.Add
Set ExcelSheet = ExcelApp.ActiveSheet
...
While intIteration < 30
...  
MercuryTimers("Save").Start
Browser("WebBrowser").Page("WebPage").Link("Save").Click
Browser("WebBrowser").Page("WebPage").WebElement("Success").CheckProperty "visible", True, 30000
intSave= MercuryTimers("Save").Stop
...
Services.SetTransaction "Iteration",intIteration, Pass
labels = Array("Login", "Mainpage","Search", "Save", "Logout")
results = Array(intLogin, intMainpage, intSearch, intSave, intLogout)
For i=0 to 4
results(i) = results(i)/1000
ExcelSheet.Cells(intIteration,i+1).Value = results(i)
Services.SetTransaction labels(i), results(i), Pass
Next
...
Wend
...
ExcelSheet.SaveAs "C:\Automation Data\SingleUser.xls"
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question adding two conditions into a while statement lotos 4 5,092 11-10-2017, 04:49 AM
Last Post: lotos
  Uft: Adding a property to all ojects into Repository ProTester 0 1,361 06-09-2017, 12:48 AM
Last Post: ProTester
  How to Delete Rows with duplicate values in 1 columns in excel thru QTP. arpan 0 2,812 02-09-2015, 08:47 PM
Last Post: arpan
  adding an object to OR seven 1 2,659 02-17-2014, 02:23 PM
Last Post: basanth27
  How to access webtables without adding into Object Repository ramkumarad 7 9,680 12-30-2013, 07:38 PM
Last Post: Sathiya

Forum Jump:


Users browsing this thread: 1 Guest(s)