Micro Focus QTP (UFT) Forums
Function calling a another funtion in functional library - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Function calling a another funtion in functional library (/Thread-Function-calling-a-another-funtion-in-functional-library)



Function calling a another funtion in functional library - saikri - 02-17-2011

Hi Can u please suggest a way to rectify

Im having a functional library with the code

Function 1 (stra)
{
Function 2(strc)
}
Funtion 2(strd)
{
{

It gives me error in the 3 statement while executing Wrong number of arguments or invalid property assignment: 'SelectSnoMedValue'

The same thing execute when i run function 2 seperately in my action

Please suggest a way

the


RE: Function calling a another funtion in functional library - jsknight1969 - 02-17-2011

OK. Maybe you are just getting caught in the when to use parenthesis or not issue. If you are assigning a variable with a function return you need them. If you are just calling a function or sub and not returning a value...you don't need them.

Code:
Function func1 ()
   'Call function 2 and pass value and get the return
   returnval = func2("Call func2 and return value")
   msgbox returnval
   'Call function or sub without a return value
   func3 "Call func3"
End Function

Function func2(strd)
  'do something here and return value
  func2 = "func2: " & strd
End function

Function func3(strf)
   'do something but no return value
   msgbox "func3: " & strf
End Function

Hope this helps.


RE: Function calling a another funtion in functional library - saikri - 02-18-2011

HI ,

Sorry for the last thread im not using any parenthesis
I have a funtional libray say y
im defining two funtion ,One funtion calling another funtion it gives me that error
Code:
Public Function Record(stname,strage)
    Browser("LorPrimary").Page("LorMain").Frame("Search").webedit("as").set "name"
call selectdtpicker(strage)
end funtion

Public Function age(strage)

Browser("LorPrimary").Page("LorMain").Frame("Search").datepeicker("as").set strage 'the date picker is an custon type

end funtion


In my action
i call
Theis funtion Record("ss","13/01/1987")

it gives me an error


RE: Function calling a another funtion in functional library - basanth27 - 02-24-2011

Where are you using the variable stname?