Micro Focus QTP (UFT) Forums
Conditional run of an action - 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: Conditional run of an action (/Thread-Conditional-run-of-an-action)



Conditional run of an action - janriis - 09-22-2010

Hi all

In my web app I am showing page A if company is A and page B if company is B...and so on.

How do i tell QTP to run a different action based on the value of the column "Company" in my Data table ?


RE: Conditional run of an action - PrabhatN - 09-22-2010

Hi janriis,

You can acheive this as follows:

1. Create an action named say "Driver_Script"

2. Inside the Driver_Script action call your company-specific actions based on your conditions. (Tick "After the current step" option while inserting the company-specific actions inside the Driver_Script action)

The Driver_Script action will have code something like the below:

Code:
If Company = "A" Then
   RunAction "Action_A", oneIteration //number of action iteration may vary
   Else
   RunAction "Action_B", oneIteration
End If

You can make use of "LoadAndRunAction" instead of "RunAction" to avoid loading of unnecessary action(s) if you have QTP 10.