Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using a For loop with variables
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
I have a For loop...

For Gr = GrStart to GrEnd

My variables GrStart = 1 and GrEnd = "14" in my Debug Viewer

For whatever reason, the For loop exists after 1 iteration even though it should continue.

Is the fact that the GrEnd = "14" (with the quotes) the issue?

Lor
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
please check this simple example
Code:
GrStart = 1
GrEnd ="14"
For Gr = GrStart to GrEnd
msgbox  GrStart
msgbox GrEnd
next

this code is working fine, i dont think there is any problem with " "
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
That's what I tought to. I set my int(GrEnd) to see and still my For exists after one iteration. Somewhere my variable is getting changed.

thx for looking ;-)

Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
could you please paste in some more code so that we can look around for the error.
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
As it turns out, another QTP coder had added a script mid steam that had changed a variable within the For loop causing it to exit after only one iteration.

That i guess will happen when more then one script creator builds the automated tests.

Thx everyone for looking.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  where to declare variables?? ACCBAJPA 0 2,364 10-01-2013, 07:20 PM
Last Post: ACCBAJPA
  Break up a string of text and variables csutter2002 3 3,608 03-20-2013, 06:58 AM
Last Post: basanth27
  FOR LOOP shayk1985 1 5,299 12-13-2012, 11:35 AM
Last Post: sams001
Question User-Defined Environment Variables vs. Global Variables vs. DataTable Values imzeeshan 0 3,002 11-16-2012, 01:51 AM
Last Post: imzeeshan
  How to exit from a for loop silpavinod 2 9,870 10-17-2012, 12:55 AM
Last Post: agarwl.anurag

Forum Jump:


Users browsing this thread: 1 Guest(s)