At 03:12 PM 9/23/2002 -0400, you wrote: >Question: > > >When returning variables from CFCs, has anyone figured out a decent way to >wrap the return variable in a container? > >I've done something like this, but it gets to be a pain in the a*s >duplicating the code: > ><cfscript> > stReturn = structNew(); > stReturn.bOK = 1; > stReturn.details = ''; > stReturn.result = ''; ></cfscript> > >Normally, the function result is stuffed in the "result" key, and the whole >struct is returned. If the method call fails, bOK is set to 0 and the >details key contains error info when the struct is returned. > >What would be the most efficient way to duplicate the code in each function >call? Just curious to see some suggestions.
That is an easy one. Create a CFC-private function that does what you need and call that single function from each method where you need the functionality. Functions by their nature aren't designed to return more than a single value. -- Jeffry Houser | mailto:[EMAIL PROTECTED] Need a Web Developer? Contact me! AIM: Reboog711 | Phone: 1-203-379-0773 -- Vote for ColdFusion: A Beginner's Guide in the ColdFusion Developer's Journal Readers Choice Awards <http://www.sys-con.com/coldfusion/readerschoice2002/> -- My CFMX Book: <http://www.amazon.com/exec/obidos/ASIN/0072225564/instantcoldfu-20> My Books: http://www.instantcoldfusion.com My Band: http://www.farcryfly.com ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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

