Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exit parent functions as well
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Is there any way we can exit the parent function as well.
E.g
Function F1
call F2
.....
.....
End Function

So if during execution of function F2 it fails and i want to exit function F2 as well as F1..Can we do that using code?
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
How about using "Exit Function" if the condition fails?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Exit function would exit only current Function .I want to exit Its parent function as well.
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Assign some unique value just before you wish to Exit the first function. Check for that return value using a conditional statement and Exit if that matches. You can extend this logic to any number of nested function calls, just need to have a unique return key

Code:
Function Ex1()    
    Ex1 = 0
    Exit Function
End Function

Function Ex2()
    Ret = Ex1()
    If Ret = 0 Then
    msgbox Ret
    'Exit Function    
    End If
End Function

Call Ex2()

Hope that helps!
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to get the links which appears on mouse hover of parent link rajendra649 9 34,832 03-10-2017, 06:35 PM
Last Post: satish00k
  verify that parent properties match object currently displayed in your application. sona 0 2,942 02-21-2016, 12:00 PM
Last Post: sona
  How to write a script for fly out menus (Parent - Child - Sub Child) rajkumarsm 3 4,447 09-02-2014, 10:01 AM
Last Post: vinod123
  Close on Exit Issue in QTP 11.0 EGBELL 1 3,064 02-02-2014, 03:39 PM
Last Post: EGBELL
  Perform some functions whenever QTP Stop button is pressed smartkarthi 2 2,938 08-22-2013, 11:43 AM
Last Post: smartkarthi

Forum Jump:


Users browsing this thread: 1 Guest(s)