At 03:18 PM 9/23/2002 -0400, you wrote: >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.
I thought about doing that, but I would have to repeat the method in each CFC. Right now, I have UDF that creates an instance of the struct. It works, but I was curious to see how others had done it. Thanks for the suggestion. ---------------------------------- Alex Sherwood PHS Collection Agency THE COLLECTORS 301.215.4200 T 301.664.6834 F www.phs-net.com ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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

