Jump to content
 English      
???en.wpa.text.hpweb2003.home??? ???en.wpa.text.hpweb2003.prodserv??? ???en.wpa.text.hpweb2003.support??? ???en.wpa.text.hpweb2003.solutions??? ???en.wpa.text.hpweb2003.buy???
» ???en.wpa.text.hpweb2003.contact???
     Forums advanced search
HP.com Home
IT Resource Center Forums > Management software and system tools > Quality Center

Quick Test Pro - Return to start of Loop

» 

IT Resource Center

» Login
» Register
» My profile
» Search knowledge base
» Forums
» Patch database
» Download drivers, software and firmware
» Warranty check
» Support Case Manager
» Software Update Manager
» Training and Education
» More maintenance and support options
» Online help
» Site map

Member icons
 
 HP moderator  HP moderator
 Expert in this area  Expert in this area
Member status
ITRC Pro ITRC Pro
250 points
ITRC Graduate ITRC Graduate
500 points
ITRC Wizard ITRC Wizard
1000 points
ITRC Royalty ITRC Royalty
2500 points
ITRC Pharaoh ITRC Pharaoh
7500 points
Olympian Olympian
20000 points
1-Star Olympian 1-Star Olympian
40000 points
2-Star Olympian 2-Star Olympian
80000 points
»  How to earn points
»  Support forums FAQs
Question status
Magical answer Magical answer
Message with a response that solved the author's question
Favorites status
Add to my favorites Add to my favorites
Delete from my favorites Delete from my favorites
This thread has been closed Thread closed
 

Content starts here
   Create a new message    Receive e-mail notification if a new reply is posted  Reply to this message
Author Subject: Quick Test Pro - Return to start of Loop      Add to my favorites
Brian Clark BA
Oct 12, 2009 11:47:27 GMT   

I have a script that contains a loop and some actions within it. I need to do an action, check a condition and then either continue with following actions or return to start of Loop and the next iteration. I do not want to Exit the Loop.

Winrunner contained a command called 'continue' which did this, is there an equivalent in QTP ?

Example
i = 1

Do While i < 4

i = i+1

If i = 2 Then

'continue' ie. return to start of loop and next iteration

End If

If i = 3 Then

Exit do

End If

loop
Note: If you are the author of this question and wish to assign points to any of the answers, please login first.For more information on assigning points ,click here


Sort Answers By: Date or Points
Thomas Köppner Expert in this area This member has accumulated 500 or more points
Oct 19, 2009 06:28:04 GMT    Unassigned

There is no continue in VB script. You can do the same, e.g. like

i = 1
Do While i < 4
  i = i+1
  If i <> 2 Then
    If i = 3 Then
      Exit do
    End If
  End If
loop
Arpan Expert in this area This member has accumulated 250 or more points
Oct 19, 2009 11:17:23 GMT    Unassigned

Can also be done using for loop.

For i = 1 To 3
  If <Your condition> Then
    <Your action>
  End If
Next

Thanks..
Arpan
Cody Marcel Expert in this area This member has accumulated 1000 or more points
Oct 19, 2009 13:31:44 GMT    Unassigned

I already answered this for you on the other thread.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1377167

i = 1
Do While i < 4

' I hope this isnt actual code since i will never = 1 in the loop body
i = i + 1

For Fake = 0 To 0
if i = 2 then
'do something
'and continue the loop
Exit For
Next
loop
 
Create a new message    Receive e-mail notification if a new reply is posted   Reply to this message
 
 
Printable version
Privacy statement Using this site means you accept its terms
© 2009 Hewlett-Packard Development Company, L.P.