Micro Focus QTP (UFT) Forums

Full Version: Trouble with For loop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When the inner for loop is over the controls are passing to the next higher for loop but gets stuck in the first statement of the outer for loop saying the parameter is incorrect.
Here is the code I am using
Code:
For i = 1 To 4  ---- When the inner loop is complete the next value in ---------the datatable is not retrieved and the error pops up 'parameter --------incorrect'
Browser("x").Page("y").WebRadioGroup("RB").Select DataTable("RB", dtGlobalSheet)
For j = 1 To 8 ---- This loop executes perfectly
[statements]
next
next

Any ideas pleaseSad
Hi Mala,

Your are using datatable in for loop and fetching data from it. Is your data in different rows and are you using DataTable.SetCurrentRow(parameter)?
If so, then use datatable.setcurrentRow(i) as first statement of your outer for loop.

Please let me know if this is not the case. Also please share the complete piece of code if possible.
Thanks Manish,
I was using DataTable.GetSheet(dtGlobalSheet).SetCurrentRow but then changed to DataTable.GetSheet(dtGlobalSheet).SetCurrentRow(i) later and got the results. However I had to make changes to the inner loop also the same way and made it DataTable.GetSheet(dtGlobalSheet).SetCurrentRow(j). Now it works fine.