[Top] [All Lists]

Re: Multi-dimensional array

Subject: Re: Multi-dimensional array
From: Adam Cameron
Date: Thu, 30 Aug 2007 22:38:35 +0100
Newsgroups: macromedia.coldfusion.cfml_general_discussion
>  "It worked fine untill one of my users set up a csv file, deleted some rows, 
> then uploaded."

Sure.  But that's the CSV file.  Why/how did the empty rows / elements get

My question was kind of leading towards: maybe it's better to not put the
empty rows in in the first place, than having to have code to deal with
them after the fact.

To answer your actual question, there's nothing native in CFMX7 which will
detect (without throwing an exception) a null array element.

However one can do it with Java, thus:

v = a.elementAt(i-1);   // where i is the array index to test
if (isDefined("v"){
        // all good
} else {
        // didn't exist

CF8 brings in arrayIsDefined()

However... I reiterate: you're better off not putting the blank records in
in the first place.  Work out why it's happening, and fix THAT.


<Prev in Thread] Current Thread [Next in Thread>