Rick, I'm delighted to see you starting to work with the power of CFCs. I also had the same confusion as you did at first. The terminology for some of these OO concepts gets a bit confusing, so perhaps i can help you by expressing some of the ideas related without using the teminology.
Perhaps it might help to see your code with notation for the same thing. ...... <cfset agent_info = agent.get_agent_info( #url.agent_id# ) /> Here you're naming a query variable "agent_info", and it's being populated with records from a function called agent.get_agent_into() which has been given the parameter #url.agent_id#. That's exactly equivalent to your code: <cfinvoke component='agent' method='get_agent_info' returnvariable='agent_info' agent_id='#url.agent_id#'> (Although you dont need the hash signs around the url variable, so it would more properly be expressed: <cfset agent_info = agent.get_agent_info( url.agent_id ) /> ) Compare this to something you've been using for a long time already like: <cfset variable1 = dateformat( createdate, "d/mm/yyyy") /> You dont need to know how dateformat goes about its business of transforming your variable in order to use it. All the work is done inside the function dateformat(). It's the same inside your function agent.get_agent_info() Now the function get_agent_info() has a limited number of things it needs to know, and doesnt care about the rest of the world. All it wants to know is the agent_id it has to look up, and the datasource name. It doesnt care about anything else, nor should it either. This is the concept of 'encapsulation' which means briefly, that each function has a specific thing it does, and it shouldnt know (or need to know) anything except what you tell it. That's just like the function dateformat() that you've been using since you started with ColdFusion so long ago. It doesnt know what you're using the date for, where the date came from or anything else. All it knows is you give it a date object and it gives you back a string. Does that help you? Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month On Mon, Jun 16, 2008 at 5:43 AM, Rick Faircloth <[EMAIL PROTECTED]> wrote: > Let's say I have link on a page back to itself: > > <a href='page.cfm?agent_id=20'>Get Agent</a> > > Then I have this in my page.cfm to invoke a cfc > called 'agent.cfc': > > <cfinvoke component='agent' > method='get_agent_info' > returnvariable='agent_info' > agent_id='#url.agent_id#'> > > > My 'agent.cfc' looks like this: > > <cffunction access='remote' name='get_agent_info' output='0' > returntype='query'> > > > <cfargument name='agent_id' type='string' required='1'/> > > > <cfquery name='get_agent' datasource='xxxxx'> > > select * from our_agents where agent_id = '#arguments.agent_id#' > > </cfquery> > > <cfif get_agent.recordcount> > <cfreturn get_agent/> > <cfelse> > <cfreturn 0/> > </cfif> > > </cffunction> > > Now, let's say the invocation is successful and I have extracted query data. > I know how to access all the query data back on the calling page (it seems > counter-intuitive that the <cfreturn> variable, 'get_agent' in my example > above, > is referenced or 'renamed as 'agent_info' as the returnvariable in the > <cfinvoke>... > why the renaming?). > > However, in my app I'm converting all the agent data from the query into > session > variables to customize my templates. > > Is there a way to do that in the .cfc or should I handle that back on my > calling .cfm page? > If I handle it in the .cfc, which I'd prefer in order to keep all processing > out of the > display page code, how would I return the session variables to the calling > page? > > Thanks for any input! > > Rick > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307538 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4