Micro Focus QTP (UFT) Forums
how to execute action 1 once only from 5 actions - 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: how to execute action 1 once only from 5 actions (/Thread-how-to-execute-action-1-once-only-from-5-actions)



how to execute action 1 once only from 5 actions - Jenny - 10-18-2010

Hi, just need some advise on this, i have a script with 5 actions

1. navigation
2. serach code
3. main loop if found then call action update otherwise call action insert.

My question is how do i just execute action 1 once only and let it loop thr from action 2 onward. i have tried this in my action 1

Code:
if Environment ("ActionIteration") = 1 then
  codes for navigation
End if

the problem is Environment ("ActionIteration") always return 1


RE: how to execute action 1 once only from 5 actions - PrabhatN - 10-18-2010

Hi Jenny,

If I have correctly understood, you have 5 actions, let say Action1..to..Action5.

Now, you want Action1 to run once and you want to put all other actions in a conditional loop.

If this is the case, the you can do this in following way:

Quote:1. Create an action and name it as say "Driver_Script"

2. Inside this action insert all your 5 actions and chose "After the current step" option for Location (Do all this in Expert View of Driver_Script action)

3. Now you can leave the first action and can put the rest actions inside a conditional loop

If this is not the case, then still you can follow this approach but with some modifications.

Please let me know for further clarification.


RE: how to execute action 1 once only from 5 actions - Jenny - 10-19-2010

thank you for the suggestion, i will try this out