var objTest = createObject("component", "testOne"); var treturnvalue = StructNew(); treturnvalue[1] = objTest.testOne(arguments.tFields);; treturnvalue[2] = objTest.testTwo(arguments.tFields); return treturnvalue; [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => BSterner [ip] => joenobody720@ex [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 5 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> CFINVOKE - Coldfusion - Advanced Techniques

CFINVOKE - Coldfusion - Advanced Techniques

Hi, I've a problem invoking 2 cfc's in one function which has same return variable. please see the below code. my question is how does it affect if i return one variable for cfreturn variable. or how do i return 2 diff.variables for one function, is it possible. ================================================== ======================= <cffunction name="test" access="remote" output="true" returnType="struct"> <cfargument name="testFields" type="struct"> <cfinvoke component="testOne" method="TestOne" returnVariable="ReturnValue"> <cfinvokeargument name="tFields" value="#tFields#"> </cfinvoke> <cfinvoke component="testOne" method="testtwo" returnVariable="ReturnValue"> <cfinvokeargument name="tFields" value="#tFields#"> </cfinvoke> <cfreturn ReturnValue> </cffunction> ================================================== ============================== ============= appreciate if anybody could help me. thanks,...

  1. #1

    Default CFINVOKE

    Hi,

    I've a problem invoking 2 cfc's in one function which has same return
    variable. please see the below code. my question is how does it affect if i
    return one variable for cfreturn variable. or how do i return 2 diff.variables
    for one function, is it possible.

    ================================================== =======================

    <cffunction name="test" access="remote" output="true" returnType="struct">
    <cfargument name="testFields" type="struct">

    <cfinvoke component="testOne"
    method="TestOne"
    returnVariable="ReturnValue">
    <cfinvokeargument name="tFields" value="#tFields#">
    </cfinvoke>

    <cfinvoke component="testOne"
    method="testtwo"
    returnVariable="ReturnValue">
    <cfinvokeargument name="tFields" value="#tFields#">
    </cfinvoke>

    <cfreturn ReturnValue>

    </cffunction>

    ================================================== ==============================
    =============

    appreciate if anybody could help me.
    thanks,

    weblover Guest

  2. #2

    Default Re: CFINVOKE

    This function will return the result from the testtwo method only, as it is called second it overwrites the ReturnValue variable set by the TestOne method.
    Stressed_Simon Guest

  3. #3

    Default Re: CFINVOKE

    To return multiple values from a function add them to a structure.
    Stressed_Simon Guest

  4. #4

    Default Re: CFINVOKE

    does it look like this. pls.advise.

    <cffunction name="test" access="remote" output="true" returnType="struct">
    <cfargument name="testFields" type="struct">

    <cfset treturnvalue = StructNew()>

    <cfinvoke component="testOne"
    method="TestOne"
    returnVariable="treturnvalue.ReturnValue(1)">
    <cfinvokeargument name="tFields" value="#tFields#">
    </cfinvoke>

    <cfinvoke component="testOne"
    method="testtwo"
    returnVariable="treturnvalue.ReturnValue(2)">
    <cfinvokeargument name="tFields" value="#tFields#">
    </cfinvoke>

    <cfreturn ReturnValue>

    </cffunction>

    weblover Guest

  5. #5

    Default Re: CFINVOKE

    I'd use one of the examples below. No need to invoke the same object twice w/i
    the same function call. Also, if you're just using numeric keys, you don't
    need a 'Struct'. Use an array.



    <!--- Option 1 --->
    <cffunction name="test" access="remote" output="true" returnType="struct">
    <cfargument name="testFields" type="struct">
    <cfscript>
    var objTest = createObject("component", "testOne");
    var treturnvalue = StructNew();
    treturnvalue[1] = objTest.testOne(arguments.tFields);;
    treturnvalue[2] = objTest.testTwo(arguments.tFields);

    return treturnvalue;
    </cfscript>
    </cffunction>

    <!--- Option 2 --->
    <cffunction name="test" access="remote" output="true" returnType="struct">
    <cfargument name="testFields" type="struct">
    <cfset var treturnvalue = StructNew()>
    <cfset var objTest = "">
    <cfobject component="testOne" name="objTest" />
    <cfset treturnvalue[1] = objTest.testOne(arguments.tFields)>
    <cfset treturnvalue[2] = objTest.testTwo(arguments.tFields)>
    <cfreturn treturnvalue>
    </cffunction>

    BSterner Guest

Similar Threads

  1. CFInvoke Tag... dumb question
    By dan_cfidiot in forum Coldfusion Server Administration
    Replies: 4
    Last Post: June 10th, 07:00 PM
  2. Using WS Stubs in CFINVOKE Tags
    By Darryl A. J. Staflund in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: July 27th, 05:45 AM
  3. the saxexception on cfinvoke wsdl
    By groovepapa in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: June 17th, 09:21 PM
  4. using cfinvoke
    By mike in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: February 24th, 04:57 AM
  5. passing structures using cfinvoke.
    By SilentBob'secretfusion in forum Coldfusion Component Development
    Replies: 1
    Last Post: February 17th, 10:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •