1 Reply Latest reply on Jul 14, 2010 2:51 AM by Sreeindia

    Is it possible to use a cfc return value use another cfc

    welcomecan Level 1

      hi friends,

      Help me,Is it possible to use a cfc return value use another cfc.give example

       

       

      regards,

      welcomecanv

        • 1. Re: Is it possible to use a cfc return value use another cfc
          Sreeindia Level 1

          Hi

           

           

          Is it like you want to access another cfc from one cfc . I have this example which works. Hope you will get an idea with this.

           

          1. cfctest.cfm

           

          <cfset testobj = #createObject("component", "znewtest")#>
          <cfdump var="#testobj.myFunction("hi")#">

           

          2. znewtest.cfc

           

          <cfcomponent>
              <cffunction name="myFunction" access="public" returntype="string">
                  <cfargument name="myArgument" type="string" required="yes">
                  <cfset myResult="foo">
                  <cfset testobj = #createObject("component", "znewtest2")#>
                  <cfreturn testobj.myFunction2("testargument")>
              </cffunction>
          </cfcomponent>

           

          3.znewtest2.cfc

          <cfcomponent>
              <cffunction name="myFunction2" access="public" returntype="string">
                  <cfargument name="myArgument" type="string" required="yes">
                  <cfset myResult="fooss">
                  <cfreturn myArgument>
              </cffunction>
          </cfcomponent>

           

          Above code is not an optimized one. Just posted as it was readily available. As you can see  znewtest.cfc (which is accessed in cfctest.cfm) is accessing myFunction2 of znewtest2.cfc. Hope this may be helpful to you. Let me know

           

          Sreekar