Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question of looping through the data table
#1
Solved: 11 Years, 3 Months, 3 Weeks 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: 11 Years, 3 Months, 3 Weeks 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: 11 Years, 3 Months, 3 Weeks 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,244 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,787 11-13-2013, 10:24 PM
Last Post: sai rajesh
  DP is not returning the whole table data content soumen 6 5,116 10-02-2013, 12:05 PM
Last Post: vvcyril
  Data table overwrite the value wajahatawan561 2 4,521 06-25-2013, 03:24 PM
Last Post: ssvali
  Script running more times than the values in global data table TPavani 5 4,378 10-04-2012, 11:18 PM
Last Post: krr

Forum Jump:


Users browsing this thread: 1 Guest(s)