Micro Focus QTP (UFT) Forums
FOR LOOP - 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: FOR LOOP (/Thread-FOR-LOOP--7067)



FOR LOOP - shayk1985 - 12-13-2012

hi,
here is my script. i m using functions.
Code:
On error resume next
Browser_Open()
Login ()
Data_Import()
here i want to give a for loop asking qtp to do this see below code
For i= 1 to RowCount
Datatable.SetCurrentRow(i)
then perform these functions: here i m unable to understand where to give "next"
Variables()
Search_Locations()
Search_Customer()
Create_Customer()
On error GOTO 0
Data_Export()
the "Next" should be here but when i m giving it here it is repeating the same iterations again
Logout()
Browser_Close()

please help

Thanks


RE: FOR LOOP - sams001 - 12-13-2012

Hi,

YOu dont have to use for loop if you set the option File->Settings->Run tab. If you set the iteration option to only one row there, loops should be used to work on all rows of DT.
Code:
for i=1 to rowcount
Datatable.SetCurrentRow(i)
'--- Code here
Next