Micro Focus QTP (UFT) Forums
Using Conditional Statement on O/P Parameter b/w QC BPT Components - 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 Conditional Statement on O/P Parameter b/w QC BPT Components (/Thread-Using-Conditional-Statement-on-O-P-Parameter-b-w-QC-BPT-Components)



Using Conditional Statement on O/P Parameter b/w QC BPT Components - Ankesh - 05-03-2012

Hi All,

I have been working with QTP for sometime. Recently we have been asked to move all our script to QC BPT. As i am very new to BPT i am not sure how to do the below task.

Till now we have been writing scripts using function. We use to return True/False value to function and in the script we chek for the return value. If the return value is False the script will exit the iteration. I am finding it difficult to achieve in BPT. i created a component with a output parameter which returns True/False. I want to make use of this parameter as a conditional statement to call other component. how is that possible?

Let me give one example..

Component1 --- "BPT LOgin" - this has an output parameter as return.

once the execution is done, i need to check the output parameter value.. something like

Code:
if Parameter("Return")=False then
'Call to logoff Component and exit
Else
'Perform some operation
End IF

Please help me achieve this.

Thanks,
Ankesh


RE: Using Conditional Statement on O/P Parameter b/w QC BPT Components - Shridevi.Salagare - 05-04-2012

Ankesh,
For this scenario what you can do is - in BPT component which is used for login ,there itself you check whether the login is successful or not by putting if condition and if not exit.No need to pass the values between components.


RE: Using Conditional Statement on O/P Parameter b/w QC BPT Components - Ankesh - 05-04-2012

Thanks Shridevi!!!

Okay, Got a solution for the issue.

I am now using the command - "ExitComponentIteration" inside the component whenever error occurs and it is working fine.

So no need to use any conditional statement. Script will automatically come out of the component.

Regards,
Ankesh


RE: Using Conditional Statement on O/P Parameter b/w QC BPT Components - Shridevi.Salagare - 05-09-2012

Np. I was referering to the condition statement to check whethere a test case is pass or fail.:-)