Time to get anal...
Why do you use the cfoutput? You know that you can do this, right:
<CFSET Foo = ArrayDeleteAt(Session.cart, Itemnum)>
You don't need to do #....#.
You can also do, and this is what I prefer:
<CFSET ArrayDeleteAt(...)>
Or, even better, rewrite the code block in cfscript:
<CFSCRIPT>
for(itemNum=len(session.cart); i gte 1; i = i - 1) {
if(listFind(deleteList, itemArray[itemNum])
arrayDeleteAt(session.cart, itemNum);
}
</CFSCRIPT>
The ArrayResize is not necessary and is only useful for initializing a
large array. The simple act of "ArrayDeleteAt" will change the size.
Of course, the wonderful thing about CF is that there are multiple ways
of doing things, so feel free to ignore me. :)
=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email : [EMAIL PROTECTED]
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Hanz Zarcovic [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 30, 2001 5:44 PM
> To: CF-Talk
> Subject: Re: Using CFLoop to delete from an Array
>
>
> You probalby want something like this :
>
> <cfoutput>
> <cfloop index="itemNum" from="#Len(session.cart)#" to="1"
> step="-1">
>
> <cfif ListFind(deleteList, itemArray[itemNum]) NEQ 0>
> #ArrayDeleteAt(session.cart, itemNum)#
> </cfif>
>
> </cfloop>
>
> #ArrayResize(session.cart, 1)#
>
> </cfoutput>
>
>
> Hope this helps.
> -eric
>
> > > <cfoutput>#ListSort(form.remove, "numeric", "desc")#</cfoutput>
> > >
> > > <cfloop index="i" list="#form.remove#">
> > >
> > > <cfoutput>
> > > #ArrayDeleteAt(session.cart, i)#
> > > #ArrayResize(session.cart, 1)#
> > > </cfoutput>
> > >
> > > </cfloop>
> > >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
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