This is the syntax for doing it with an array of structures: <cfset var result = ArrayNew(1)> <cfquery name="qry" datasource="myDatasource" result="info"> SELECT * FROM Tablename </cfquery <cfset result[1] = qry> <cfset result[2] = info> <cfreturn result>
What would be the syntax for using a structure of structures? > > Q: What's the best way to return two structures from a function? > > Should I return an array of structures or can I return the > resultInfo in one of the arguments > > from the calling program? > > Well, strictly speaking, if you set the value of something within the > calling program that's not returning a value. You'll want to return a > single value, which could be an array or a structure. It really > doesn't matter which you do. I'd probably return a structure with > both, if I wanted to return both, so that I could then refer to the > contents of that structure by name instead of by position. Arrays are > generally used to hold a bunch of items of the same type, although CF > doesn't force you to only put items of one type within an array as > many other languages do. > > Gerald's point about returning arrays of structures is useful if > you're going to interact with non-CF systems, but those systems won't > be able to consume a query object anyway, so that's not too important > in this case. If you wanted to write a service which could be > consumed > by other platforms, you'd have to return the query itself as an array > of structures. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > > Fig Leaf Software provides the highest caliber vendor-authorized > instruction at our training centers in Washington DC, Atlanta, > Chicago, Baltimore, Northern Virginia, or on-site at your location. > Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320721 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4