Fixed.... adding <cfset queryfilter = structNew()> inside the loop did the trick...
At 06:12 PM 7/14/02 -0700, you wrote: >Hi, > >No I do not need a 2 dimensional array. I pasted a bit of the code below. >It does not generate an error, but if I try to get a structure form any >position in the array it returns the last structure to be added. Using ><cfset tempstruct2=QueryfilterARRAY[1][1]>, or <cfset >tempstruct2=QueryfilterARRAY[2][1]>, or <cfset >tempstruct2=QueryfilterARRAY[3][1]> all return the data from the last >iteration of the cfoutput below. > > ><!--- create the array and structure ---> ><cfset queryfilterARRAY = ArrayNew(2)> ><cfset queryfilter = structNew()> > > <cfquery datasource="#datasource#" >name="filterclause"> > select >filterposition,field,operator,criteria,state,datetype,cID > from lffilter_clause > where filterID=#val(attributes.filterID)# > order by filterposition asc > </cfquery> > > > > <cfset count=0> > <cfoutput query="filterclause"> > <cfset count=count+1> > > <!--- >create the variable to insert ---> > <cfset >queryfilter.datetype=filterclause.datetype> > <cfset >queryfilter.field=filterclause.field> > <cfset >queryfilter.operator=filterclause.operator> > <cfset >queryfilter.criteria=filterclause.criteria> > <cfset >queryfilter.state=filterclause.state> > > <!--- append the >structure to the next position in the array ---> > <cfset >queryfilterARRAY[#count#][1]="#queryfilter#"> > </cfoutput> > >At 08:11 PM 7/14/02 -0400, you wrote: > >At 04:27 PM 7/14/2002 -0700, you wrote: > > >I am trying to next a structure within an array. Like this, while > looping. > > > > > ><cfset queryfilterARRAY[#count#][1]=queryfilterStruct> > > > > Can we see the full code? In the example above, we do not know what > >queryfilterStruct is. Nor am I sure why you need a two dimensional array. > > > > >This seems to work okay, but when I try to retrieve the structure from a > > >position in the array, the retrieved data is always the last structure > > >inserted. The structure added last seems to replace all of the previously > > >added values. > > > > > >Am I missing something obvious here? CAN you nest structures within an > > >array? > > > > Yes! An array element can contain any data type, including structures > >(and other arrays). > > > > > > >Also, does the way the array is initialized have any bearing here? > > > > No! > > > > > > >I > > >am initializing it like this <cfset queryfilterARRAY = ArrayNew(2)> > > > > Why do you need a two dimensional array? > > > > > >-- > >Jeffry Houser | mailto:[EMAIL PROTECTED] > >Need a Web Developer? Contact me! > >AIM: Reboog711 | Phone: 1-203-379-0773 > >-- > >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 > > > > > ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com 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

