Passing a query object to a CFC and then using that for a query of queries?
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:324730 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Passing a query object to a CFC and then using that for a query of queries?
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.comwrote: 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
Re: Passing a query object to a CFC and then using that for a query of queries?
That was it, Francois. Thanks. On Mon, Jul 20, 2009 at 1:05 PM, Francois Levesque cfab...@gmail.comwrote: 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:324735 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Passing a query object to a CFC and then using that for a query of queries?
I've never been able to use a multipart identifier for a table in query of queries until we figured out that it does let you put brackets in... ie... FROM [arguments.dataIn] -- Rick Root New Brian Vander Ark Album, songs in the music player and cool behind the scenes video at www.myspace.com/brianvanderark ~| 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:324736 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Passing a query object to a CFC and then using that for a query of queries?
(Admittedly this problem for us occurred when we used a defined LOCAL scope inside the function... ie cfset var LOCAL = structNew() and then cfquery name=LOCAL.qry datasource=whatever) and then in a query of queries... we'd always get errors when trying to do select * from LOCAL.qry Rick On Mon, Jul 20, 2009 at 1:17 PM, Rick Rootrick.r...@webworksllc.com wrote: I've never been able to use a multipart identifier for a table in query of queries until we figured out that it does let you put brackets in... ie... FROM [arguments.dataIn] -- Rick Root New Brian Vander Ark Album, songs in the music player and cool behind the scenes video at www.myspace.com/brianvanderark ~| 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:324738 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4