> ONLY if you DON'T use the listAppend() function What problems have you had with listappend()? Is it just slow, or does it cause other headaches? Is it common knowledge that people shouldn't really use the function? Just curious because I've used it quite a bit.
Adam. > -----Original Message----- > From: Bryan Love [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 15, 2002 4:38 PM > To: CF-Talk > Subject: RE: Deleting Row from Array > > > Your post caused me to go test our theories... > > In general you are correct. > > A simple array is faster than a simple list. If you start > getting into > arrays of structs or multi-dimensional arrays then lists can > be faster, but > ONLY if you DON'T use the listAppend() function (built the > list by saying > tempList = tempList & "whatever") > > An old application I wrote years ago ran very slow with > arrays of structs > and I was able to cut the processing time by a factor of 10 just by > switching to lists, but I suppose that would be an extreme case. > > Just goes to show we should never stop questioning ourselves! > > +-----------------------------------------------+ > Bryan Love > Macromedia Certified Professional > Internet Application Developer > Database Analyst > Telecommunication Systems > [EMAIL PROTECTED] > +-----------------------------------------------+ > > "...'If there must be trouble, let it be in my day, that my > child may have > peace'..." > - Thomas Paine, The American Crisis > > > > -----Original Message----- > From: Kwang Suh [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 15, 2002 1:56 PM > To: CF-Talk > Subject: RE: Deleting Row from Array > > > I'm fairly certain that arrays are much, much faster than lists. Lis > ts are > nothing but strings, and I can't see how looking for a user defined > delimiter character in a list could be faster than a system defined > delimiter in an array. > > -- > > > > In CF lists are much faster than arrays. You can access itemID and q > ty > by > using listFirst() and listLast(). Besides, it's easier to understand > and > manipulate single dimension arrays. > > Anyway, that being said, here is your problem: > arrayDeleteAt returns a boolean true/false, so when you say > <cfset session.cart = ArrayDeleteAt(session.cart,form.counter)> > you are actually setting session.cart to "true". Do this: > <cfset temp = ArrayDeleteAt(session.cart,form.counter)> > > > > +-----------------------------------------------+ > Bryan Love > Macromedia Certified Professional > Internet Application Developer > Database Analyst > Telecommunication Systems > [EMAIL PROTECTED] > +-----------------------------------------------+ > > "...'If there must be trouble, let it be in my day, that my child may > have > peace'..." > - Thomas Paine, The American Crisis > > > > -----Original Message----- > From: Douglas Jordon [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 15, 2002 12:12 PM > To: CF-Talk > Subject: Re: Deleting Row from Array > > > It's two dimensional because I'm storing item ids and quantities, so > [1][1] is an id and [1][2] is a quantity etc. > > With your code I'm getting: > > ArrayDeleteAt(Array, Position): Cannot delete element at position 3. > The > array has only 2 elements. > > And the Array has three elements. > > Bryan Love wrote: > > > Why is it a two dimensional array? > > > > A two dimensional array is an array of arrays... > > > > Say a person has 3 items in their basket... > > > > if you store them like so... > > basket[1][1] > > basket[1][2] > > basket[1][3] > > ..then deleting item 1 in the first dimension wipes out the entire > > basket. > > Try this... > > <cfset session.cart = ArrayDeleteAt(session.cart[1],form.counter) > > > > > > If you aren't storing the items in the above fashion then you'll ne > ed > > to > > provide more info before you'll find a solution. > > > > +-----------------------------------------------+ > > Bryan Love > > Macromedia Certified Professional > > Internet Application Developer > > Database Analyst > > Telecommunication Systems > > [EMAIL PROTECTED] > > +-----------------------------------------------+ > > > > "...'If there must be trouble, let it be in my day, that my child m > ay > > have > > peace'..." > > - Thomas Paine, The American Crisis > > > > -----Original Message----- > > From: Douglas Jordon [mailto:[EMAIL PROTECTED]] > > Sent: Friday, February 15, 2002 11:14 AM > > To: CF-Talk > > Subject: Deleting Row from Array > > > > Hi, > > > > I'm using ArrayDeleteAt to remove single items from a shopping > cart(my > > first): > > > > <cfset session.cart = ArrayDeleteAt(session.cart,form.counter)> > > > > It's removing everything from the array instead of one row. It's a > two > > dimensional array. > > > > TIA, > > > > Doug Jordon > > > > > > _____________________________________________________________________ > _ > Dedicated Windows 2000 Server > PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER > Instant Activation * $99/Month * Free Setup > http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona > 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 > > > ______________________________________________________________________ Why Share? Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc 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

