10 Replies Latest reply on Aug 17, 2007 7:02 PM by Newsgroup_User

    CFC not changing

    hml398 Level 1
      I have an inherited program that has a CFC that was setup with the wrong ReturnType. So I changed the Returntype but the application doesn't seem to be recognizing the change. I even made some junky errors in the CFC to see if I was doing something wrong but it doesn't recognize those changes either. so obviously it isn't calling the CFC again. I am VERY new to using CFCs so I am not sure what I need to do to force the app to reinitialize or call the CFC again. Any help would be greatly appreciated. Under a bit of a time crunch :)
        • 1. Re: CFC not changing
          Dan Bracuk Level 5
          Perhaps the problem is with the template calling the cfc and not the cfc itself.
          • 2. Re: CFC not changing
            hml398 Level 1
            This is the error message I get back:

            The value returned from function getThreadIdFromMessageId() is not of type struct.

            This is the calling code: <cfset application.user.subscribe(request.user.username, application.thread.getThreadIdFromMessageId(msgid))>

            This is the function in the .cfm

            <cffunction name="getThreadIdFromMessageId" access="public" returnType="string" output="false"
            hint="Returns thread ID based on a message ID">
            <cfargument name="id" type="uuid" required="true">
            <cfset var qGetThread = "">

            <cfquery name="qGetThread" datasource="#variables.dsn#">
            select A.threadidfk
            from #variables.tableprefix#messages A
            where A.id = <cfqueryparam value="#arguments.id#" cfsqltype="CF_SQL_VARCHAR" maxlength="35">
            </cfquery>

            <!--- Throw if invalid id passed --->
            <cfif not qGetThread.recordCount>
            <cfset variables.utils.throw("ThreadCFC","Invalid message ID")>
            </cfif>

            <cfreturn qGetThread.threadidfk>

            </cffunction>

            • 3. Re: CFC not changing
              CF_Oracle
              Check that you call right directory where your cfc is located and that changes placed on right cfserver.
              • 4. Re: CFC not changing
                Level 7
                In article <f97ild$jqn$1@forums.macromedia.com> "hml398"
                <hlukes@digital-wise.com> wrote:
                > I have an inherited program that has a CFC that was setup with the
                > wrong ReturnType. So I changed the Returntype but the application
                > doesn't seem to be recognizing the change.

                Is the CFC in application scope? If so, you need to tell the
                application to reinitialize (which will depend on the application -
                but most applications that store data in application scope provide
                some way of forcing a reinitialization).

                Sean A Corfield
                An Architect's View -- http://corfield.org/


                --
                I'm using an evaluation license of nemo since 61 days.
                You should really try it!
                http://www.malcom-mac.com/nemo

                • 5. Re: CFC not changing
                  Level 7
                  In article <f97ka2$ltg$1@forums.macromedia.com> "hml398"
                  <hlukes@digital-wise.com> wrote:
                  > This is the calling code: <cfset
                  > application.user.subscribe(request.user.username,
                  > application.thread.getThreadIdFromMessageId(msgid))>

                  As I said, you need to tell the application to reinitialize its
                  application variables. Until you do that, it won't even try to create
                  a new instance of the CFC.

                  Sean A Corfield
                  An Architect's View -- http://corfield.org/

                  --
                  I'm using an evaluation license of nemo since 61 days.
                  You should really try it!
                  http://www.malcom-mac.com/nemo

                  • 6. Re: CFC not changing
                    kepin
                    Sean Corfield, can you tell me how to "reinitialize its application variables" ? sorry, i'm totally new with Cf...

                    thanks in advanced
                    • 7. Re: CFC not changing
                      Level 7
                      kepin wrote:
                      > Sean Corfield, can you tell me how to "reinitialize its application variables" ? sorry, i'm totally new with Cf...
                      >
                      > thanks in advanced

                      Your not "reinitializing its application variables" you are
                      reinitializing the application variable that the CFC instance is stored
                      in. Application variables are designed to live from one request to
                      another for the life of an application. If a cfc has been stored into a
                      application variable with something like <cfset application.myCFC =
                      createObject("component",path.to.a.cfc)>. That instance is not going to
                      change until that <cfset...> tag is run again.

                      You just need to do what has been provided to allow that code to be run
                      again. Developers will often put a URL variable such a "reset" or
                      "refresh" that will trigger code to run the <cfset...> line again.

                      Or one can set the application time out to be very short so that the
                      application data will clear once the specified time of inactivity has
                      occurred.

                      Or one can restart the CF service/server so that all variables are
                      redefined.

                      • 8. Re: CFC not changing
                        Dan Bracuk Level 5
                        quote:

                        Originally posted by: hml398
                        This is the error message I get back:

                        The value returned from function getThreadIdFromMessageId() is not of type struct.

                        This is the calling code: <cfset application.user.subscribe(request.user.username, application.thread.getThreadIdFromMessageId(msgid))>

                        This is the function in the .cfm

                        <cffunction name="getThreadIdFromMessageId" access="public" returnType="string" output="false"
                        hint="Returns thread ID based on a message ID">
                        <cfargument name="id" type="uuid" required="true">
                        <cfset var qGetThread = "">

                        <cfquery name="qGetThread" datasource="#variables.dsn#">
                        select A.threadidfk
                        from #variables.tableprefix#messages A
                        where A.id = <cfqueryparam value="#arguments.id#" cfsqltype="CF_SQL_VARCHAR" maxlength="35">
                        </cfquery>

                        <!--- Throw if invalid id passed --->
                        <cfif not qGetThread.recordCount>
                        <cfset variables.utils.throw("ThreadCFC","Invalid message ID")>
                        </cfif>

                        <cfreturn qGetThread.threadidfk>

                        </cffunction>



                        First, there is no indication that you are calling the function in the cfc. In fact there is no indication that you have a cfc. Is there a typo on this line?
                        This is the function in the .cfm

                        Next, your cffunction tag says that it returns a string. If your query returns more than one row, this could be a problem. An easy way to solve that is to specify the row number in your cfreturn tag.

                        Finally, your cfset tag should probably have an equal sign in it somewhere.
                        • 9. Re: CFC not changing
                          kepin Level 1
                          hml398, I found a solution :

                          Find in thread.cfc around line 118 : <cffunction name="getThreadIdFromMessageId" access="public" returnType=" struct" output="false" hint="Returns thread ID based on a message ID">

                          Change to : <cffunction name="getThreadIdFromMessageId" access="public" returnType=" string" output="false" hint="Returns thread ID based on a message ID">

                          That's it :) Should work....
                          • 10. Re: CFC not changing
                            Level 7
                            hmm... looking at all code posted in this thread, i can not find
                            anywhere returnType="struct" in that function... as far as i can see, it
                            has always been declared as "string"... am i missing something here?
                            --

                            Azadi Saryev
                            Sabai-dee.com
                            http://www.sabai-dee.com