Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question of looping through the data table
#1
Solved: 10 Years, 9 Months ago
hi Ankur and all,

Again one basic question regarding looping through all datatable rows,
I write values 1,2,3,4 in four rows of TCNo column in the Datatable and write the code below.

Code:
Tccount = DataTable.GetSheet("Global").GetRowCount
FormulaVal=DataTable.GetSheet("Global").GetParameter("TCNo").RawValue

For Currentrow=1 to  Tccount
Currentrow=Currentrow+FormulaVal-1

msgbox Currentrow
Next


My question is: In the first run the script goes through the loop 4 times then exits, then again the Variable FormulaVal takes on the value of the next row and For... next loop is executed. How is this possible ? and can you suggest a efficient way of reading the total no. of rows and then looping through for Data driven testing.
Reply
#2
Solved: 10 Years, 9 Months ago
Changed the Action call property as run one iteration, instead of run on all rows. This solved the above problem.

Still somebody can suggest [ a efficient way of reading the total no. of rows and then looping through for Data driven testing].
Reply
#3
Solved: 10 Years, 9 Months ago
HI You can use the following code:

Code:
For i = 1 to datatable.getrowcount
   'print datatable("Name")
  datatable.setnextrow    
Next


There is another suggestion, you can use print instead of msgbox(). Try it Smile

Thanks,Rahul.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with Select checkbox from data table value jayraocourts 0 1,056 11-01-2019, 10:25 PM
Last Post: jayraocourts
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,608 11-13-2013, 10:24 PM
Last Post: sai rajesh
  DP is not returning the whole table data content soumen 6 4,737 10-02-2013, 12:05 PM
Last Post: vvcyril
  Data table overwrite the value wajahatawan561 2 4,253 06-25-2013, 03:24 PM
Last Post: ssvali
  Script running more times than the values in global data table TPavani 5 4,151 10-04-2012, 11:18 PM
Last Post: krr

Forum Jump:


Users browsing this thread: 1 Guest(s)