It looks good but the first line of the script should read:
form.INDEX_TO_DELETE = LISTSORT(form.INDEX_TO_DELETE,"NUMERIC","DESC");
OR don't change it and use variables.INDEX_TO_DELETE in the rest of the code
-----Oorspronkelijk bericht-----
Van: Bosky, Dave [mailto:[EMAIL PROTECTED]
Verzonden: do 13/03/2003 17:37
Aan: CF-Talk
CC:
Onderwerp: Arrays -Deleting specific items
I have an array and need to delete specific positions by using a list of
positions to delete.
Array contains 8 items and I need to delete the items at positions
"2,3,4,5,6".
I've been using the code below and it works most of the time if I delete one
at time but
once I try to delete multiple items it errors out. I'm obviously overlooking
something and
extra eyes would be great!
<CFSCRIPT>
INDEX_TO_DELETE = LISTSORT(form.INDEX_TO_DELETE,"NUMERIC","DESC");
FOR (INDEX=1;INDEX LTE ListLen(form.index_to_delete); INDEX=INDEX+1)
{
ArrayDeleteAt(session.aCart,ListGetAt(form.index_to_delete,index));
}
</CFSCRIPT>
Thanks,
Dave
HTC Disclaimer: The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this message is not
the intended recipient, or an employee or agent responsible for delivering this
message to the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by replying to the
message and deleting it from your computer. Thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Get the mailserver that powers this list at http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4