On Wednesday, September 4, 2002, at 11:00 , Jon Gorrono wrote:
> My tests of using cfset in the 'this' scope have failed to get
> persistence btween calls to remote methods. For example, I 1)
> initilialize this.lasterror before any function tag 'declarations', 2)
> change the value in one method, which also puts the proof into cflog, 3)
> then call another method (using the same line of code).... blotto! The
> value gets re-initialized just b4 the second method call...

You don't show your code but I'll bet you are doing something like:

        <cfinvoke component="foo" method="bar"/>
        <cfinvoke component="foo" method="fubar"/>

This creates a separate instance for each invoke so your CFC is being 
initialized each time. In order to persist instance data between calls, 
you must use the *same* instance:

        <cfset foo = createObject("component","foo")/>
        <cfinvoke component="#foo#" method="bar"/>
        <cfinvoke component="#foo#" method="fubar"/>

Note that you do NOT need a *persistent* scope per se, just a scope that 
covers all the calls you need to make - in the case above, variables scope 
(the default) is fine. If you need to access that single instance across 
multiple pages, then request or session scope would be more appropriate.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to