No value is returned to function call line - 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: No value is returned to function call line (/Thread-No-value-is-returned-to-function-call-line) |
No value is returned to function call line - MGMN - 09-19-2008 When I call a function which should return true/false it doesn't seem to return any value. The value is printed out to the report in the function itself. Test file where I call the function: Code: TestFunction sMenuClick, noMenuVal Function file: Code: Function TestFunction (sMenuClick, noMenuVal) I get a general run error in the Reporter line where I try to write the TestFunction value to the report. I guess it's a simple thing I'm forget, do you see what could be wrong? RE: No value is returned to function call line - Ankur - 09-19-2008 Here you go: Code: x = TestFunction (sMenuClick, noMenuVal) 'Function file: Code: Function TestFunction (sMenuClick, noMenuVal) You forgot to assign the return value to a variable. Next time please format the code while posting a query. RE: No value is returned to function call line - swat2008 - 09-20-2008 Here are 2 ways to fix the issue. I hope this helps. 1.**************Here you are calling the function in the reporter statement Code: Reporter.ReportEvent micPass, "Test Function", "TestFunction: " & TestFunction( sMenuClick, noMenuVal ) 2. **********here you store the result of the function into a variable and then use the variable in the reporter statement Code: TestResult = TestFunction (sMenuClick, noMenuVal) RE: No value is returned to function call line - MGMN - 09-20-2008 Thanks for your answers, Ankur and swat2008! I knew that it was an easy thing I had forgot. I promise to format my pasted code next time. |