so why not try just cfloop over the query normally and output only the columns you want <cfloop query="myquery> <cfsavecontent variable="currentrow">#column1# #columns2# etc...</cfsavecontent> <cfset fileOutput.write( currentrow.toString() )> </cfloop>
On Thu, Aug 18, 2011 at 3:39 PM, Rick Root <[email protected]> wrote: > > >does the original data need to be a 2 dimensional array or can you > generate > >it as q uery, then you only have 1 loop. > > It actually is a query - however the query contains fields that aren't > necessarily going to be in the output file. There wouldn't necessarily have > to be an inside loop but the alternative would be something like > > <cfif arrayFind(fieldsArray,'MYCOL1')> .. output MYCOL1 ...</cfif> > ... > <cfif arrayFind(fieldsArray,'MYCOL180')> .. output MYCOL180 ...</cfif> > > And I don't think that would be very efficient. > > -- > For what it's worth, > > Looping over the fields array: > > <cfloop array="#fieldsArray#" index="local.field"> > <cfset fileOutput.write( > resultSet[local.field][resultSet.currentRow].toString() )> > </cfloop> > > was 3 seconds slower than the original code on a query of 6000 rows and > outputting all 180 columns. > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346834 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

