Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
5 years ago

How can I check a function return type in another function in vb script.

How can I check a function return type in another function in vb script. like there are 2 function.Kindly check below   Function A()      Set obj = ----------something here-----     If(Obj.Exist...
  • tristaanogre's avatar
    5 years ago

    Um... OK, so that's some basic VBScripting there.  Simply...

     

    Function A()
    
         Set obj = ----------something here-----
         A = Obj.Exists
    
    End Function

    And then, in function B

     

    Function B()
    
         If A then
              Log.Message("Object exists")
         else
              Log.Message("Object does not exists")
         End If
    End Function
  • rajulapati's avatar
    5 years ago

    You can try below scenario and check if it works for you

    Function A()

         Set obj = ----------something here-----

        If(Obj.Exists) then

             Log.message("ok")

             strResult=TRUE

        Else

            log.message("not ok")

           strResult=FALSE

        End IF

       A=strResult

    End Function

     

    Function B()

      strResult=A()

       If strRESUlt=TRUE Then

          log.Message"True"

    Else

         log.Message"False"

    End Function