• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Jul 13, 2010 Jul 13, 2010

Copy link to clipboard

Copied

hi friends,

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

regards,

welcomecanv

TOPICS
Builder

Views

427

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 14, 2010 Jul 14, 2010

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation