Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to return value from a user-defined function to the calling Test
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
[/align]Using the Insert->Function Definition Generator i created a new function mysum with two variables var1 and var2 (both having passmode = By value)

I want this function to add the 2 variables and return the sum to the calling test.

code for the function:
Code:
Public Function mysum(var1, var2)
       ' TODO: add function body here
       sum=var1+var2
       msgbox(var1 & "+" & var2 & "=" & sum)
       return(sum)
End Function

TestCode:
Code:
sum=mysum(1,2)
Reporter.ReportEvent micPass, "ReportStepName Pass", "Sum=" &sum

Result:
I get a Type mismatch error. I tried all combinations of function definitions like: e.g. int Public Function mysum(var1, var2) but i still get the type mismatch error.
Reply


Messages In This Thread
Unable to return value from a user-defined function to the calling Test - by richagoyalk - 06-03-2009, 12:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT 12.02 Compatibility for IE 11.0 : Fail to identify the defined Object Amruta_121 9 11,161 01-11-2016, 12:45 PM
Last Post: vinod123
  Childobject return wrong checkbox count.. VpnQTP 1 2,846 04-09-2015, 09:07 PM
Last Post: babu123
  Calling a Function in Function Library when function is defined in an Action jitenderkkr 0 2,966 11-27-2014, 12:53 PM
Last Post: jitenderkkr
  calling QTP script from one to another krishnas.tester 3 6,724 11-12-2014, 10:32 AM
Last Post: vinod123
  calling stored procedure from Oracle borisk 3 6,446 03-19-2013, 12:41 PM
Last Post: gaveyom

Forum Jump:


Users browsing this thread: 2 Guest(s)