I tried that, too. Same error (see below).

Ironically, I started reading an article at work on Friday and just a minute
ago, I picked the magazine up -- CFDJ.  The article is "Toward Better Error
Handling" by Charles Arehart.  It's in the June 2001 issue.

This is the exact paragraph I stopped short on Friday and started with this
morning:

(speaking of CFTry/CFCatch):  "In a previous CFDJ article, "Testing
Existence in Arrays," (Vol. 3, Issue 4), I showed how attempting to refer to
an array element that doesn't exist will generate a runtime exception.
Unfortunately, there's simply no function to rest for such existence (see
the article for more on why IsDefined and others simply won't work in this
circumstance). As the article demonstrated, you could wrap such array
element references in a CFTry and use CFCatch to simply ignore the error."

So, tonight, I'll wrap my code reading the Array in a CFtry and see if that
doesn't solve the problem.

H.


Howard Owens
Internet Operations Coordinator
www.insidevc.com
[EMAIL PROTECTED]
AIM: GoCatGo1956


> -----Original Message-----
> From: Craig Dudley [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, October 01, 2001 7:28 AM
> To:   CF-Talk
> Subject:      RE: Using CFLoop to delete from an Array 2
> 
> Change
> 
> <cfif ArrayIsEmpty(session.cart[1])>
> the array is empty
> </cfif>
> 
> to
> 
> <cfif ArrayIsEmpty(session.cart)>
> the array is empty
> </cfif>
> 
> Assuming that session.cart is not an array of arrays. 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 01 October 2001 01:07
> To: CF-Talk
> Subject: RE: Using CFLoop to delete from an Array 2
> 
> 
> OK,
> 
> Now that I've got the multiple deletes from the array working (thanks,
> guys)
> . I've got a problem when every element in the array is deleted (an option
> a user could conceivably take).
> 
> There is later on the page, of course, code that assumes there is going to
> be information in the array to read. If everything in the array is
> deleted,
> then there's an error.
> 
> The obvious thing to do is set up some sort of conditional to find that
> the
> array has been cleared of all items, but I'm having trouble finding the
> right syntax.
> 
> I've tried things like:
> 
> <cfif ArrayIsEmpty(session.cart[1])>
> the array is empty
> </cfif>
> 
> And variations of other conditional tests and I repeatedly get this error
> message:
> 
>       "The element at position 1 in dimension 1 of object "session.cart"
> cannot
> be found.
>       The object has elements in positions 1 through 1. Please, modify the
> index
> expression.
> 
> So I've run out of ideas to try to catch this now empty array and through
> up
> some appropriate HTML.
> 
> H.
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to