Micro Focus QTP (UFT) Forums
Using a For loop with variables - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Using a For loop with variables (/Thread-Using-a-For-loop-with-variables)



Using a For loop with variables - mv8167 - 11-30-2011

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


RE: Using a For loop with variables - swathi - 11-30-2011

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 " "


RE: Using a For loop with variables - mv8167 - 11-30-2011

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 ;-)




RE: Using a For loop with variables - parminderdhiman84 - 12-01-2011

could you please paste in some more code so that we can look around for the error.


RE: Using a For loop with variables - mv8167 - 12-01-2011

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.