Hi Pete, You don't need the hash signs around your table name in a QoQ: <cffunction name="sortDataFromQry" returntype="query"> <cfargument name="dataIn" type="query" required="yes"> <cfargument name="orderBy" type="string" required="yes"> <cfquery name="getData" dbtype="query"> SELECT * FROM arguments.dataIn ORDER BY #arguments.orderby# </cfquery> <cfreturn getData> </cffunction>
Should work. Francois Levesque http://blog.critical-web.com/ On Mon, Jul 20, 2009 at 1:00 PM, Pete Ruckelshaus <pruckelsh...@gmail.com>wrote: > > I'm stuck. Actually, I'm probably just being stupid. > I want to pass a query object into a CFC and then use query of queries to > manipulate that query object. > > Here's the contents of my db.cfc file: > > <cfcomponent> > <cffunction name="getContacts" returntype="query"> > <cfquery name="getData" datasource="adventureworks"> > SELECT top 100 * > FROM person.contact > </cfquery> > <cfreturn getdata> > </cffunction> > <cffunction name="sortDataFromQry" returntype="query"> > <cfargument name="dataIn" type="query" required="yes"> > <cfargument name="orderBy" type="string" required="yes"> > <cfquery name="getData" dbtype="query"> > SELECT * > FROM #arguments.dataIn# > ORDER BY #arguments.orderby# > </cfquery> > <cfreturn getData> > </cffunction> > </cfcomponent> > > And here's the important stuff from my calling page: > > <cfinvoke component="db" method="getContacts" > returnvariable="getContacts"></cfinvoke> > <cfinvoke component="db" method="sortDataFromQry" > returnvariable="getContacts1"> > <cfinvokeargument name="dataIn" value="#getContacts#"> > <cfinvokeargument name="orderby" value="firstname"> > </cfinvoke> > > The problem is that the CFC is throwing a "Complex object types cannot be > converted to simple values." error. How do I get the sortDataFromQry > function to see dataIn as a recordset? > > Thanks > > Pete > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324732 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4