Hi All, Have not been online like this all summer... but now I'm bloody stuck. I have been chasing my tail for a few days now.
I am looping through a record set(OldQuery) and adding an arbitrary number of NewColumns to it, the number of columns added is dependent upon how many of something else NotImportantHere that I find. I hope the code here is clear in it's intention... but the code is failing. I can't seem to get the VariableNaming and using of Arrays proper. Any and all help appreciated... Bottomline, just can't see my way past the dynamic naming and using of the Arrays described below. <cfset MaxColNum = 0> <cfloop index="i" from="1" to="#OldQuery.RecordCount#"> <cfquery name="NewQuery"><!---Get Some NewData to Add to the OldQuery---> SELECT * From SomeOtherTable WHERE SomeValue = OldQuery.SomeValue[i] </cfquery> <cfif NewQuery.RecordCount><!---Then add NewQuery info to proper 1 dimensional Array---> <cfif NewQuery.RecordCount GT MaxColNum> <cfset MaxColNum = NewQuery.RecordCount> </cfif> <cfloop index="j" from="1" to="NewQuery.RecordCount"> --- problem is below --- <cfif isDefined("NewCol#j#")> <cfset NewCol#j#[i] = NewQuery.TheNewData[j]> <cfelse> <cfset NewCol#j# = NewArray(1)> <cfset NewCol#j#[i] = NewQuery.TheNewData[j]> --- problem is above --- </cfif> </cfloop> </cfif> </cfloop> <!---Now Add the NewColArrays built above into the Origional OldQuery---> <cfloop index="j" from="1" to="#MaxColNum#"> --- another problem is below --- <cfset nCol = QueryAddColumn(OldQuery, "ColName#j#", NewCol#j#)> --- another problem is below --- </cfloop> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4