Edit that (woops):
<cfscript>
function RemoveEmptyArrayElements(a_array)
{
var a_fixer = ArrayNew(1);
a_fixer[2 ] = "";
a_array.RemoveAll(a_fixer);
return a_array;
}
</cfscript>
<cfset CiteDataArr = RemoveEmptyArrayElements(CiteDataArr)>
<cfloop from="1" to="#ArrayLen(CiteDataArr)#" index="i">
Dom
On 10/08/07, Dominic Watson <[EMAIL PROTECTED]> wrote:
>
> Here is another solution I just came up with which I think is a little
> more elegent + efficient if neccessary; it removes all blank elements before
> looping the array:
>
> <cfscript>
> function RemoveEmptyArrayElements(a_array)
> {
> var a_fixer = ArrayNew(1);
> a_fixer[2 ] = "";
> a_array.RemoveAll(a_fixer);
> }
> </cfscript>
>
> <cfset
> CiteDataArr = RemoveEmptyArrayElements(CiteDataArr)>
> <cfloop from="1" to="#ArrayLen(CiteDataArr)#" index="i">
> ...
> Dom
>
>
> On 09/08/07, Brian Kotek <[EMAIL PROTECTED]> wrote:
> >
> > In the future, if you know you are going to have a "spotty" array like
> > this,
> > it is an indicator that a structure might be a better choice to hold the
> >
> > data.
> >
> > Regards,
> >
> > Brian
> >
> > On 8/9/07, Scott Stewart <[EMAIL PROTECTED]> wrote:
> > >
> > > Hey all,
> > >
> > > I wrapped the code up in a try/catch block and it deals with the
> > problem.
> > > I can't really say it works cause the error is still there, but the
> > > application doesn't stop working because of it.
> > >
> > > Thanks much, I was under a time crunch and the CF Talk list saved by
> > butt
> > > again.
> > >
> > > --
> > > Scott Stewart
> > > ColdFusion Developer
> > >
> > > SSTWebworks
> > > 4405 Oakshyre Way
> > > Raleigh, NC. 27616
> > > (703) 220-2835
> > >
> > > http://www.sstwebworks.com
> > > http://www.linkedin.com/in/sstwebworks
> > >
> > >
> > > -----Original Message-----
> > > From: Charlie Griefer [mailto: [EMAIL PROTECTED]
> > > Sent: Thursday, August 09, 2007 4:21 PM
> > > To: CF-Talk
> > > Subject: Re: determining the exiistance of an Array element
> > >
> > > On 8/9/07, Dave Watts < [EMAIL PROTECTED]> wrote:
> > > > > CF arrays are dynamically sized... so if an element doesn't
> > > > > exist, the array "shrinks".
> > > >
> > > > The array only shrinks when you delete an array element. If you
> > create
> > > an
> > > > array with non-contiguous positions, the missing positions simply
> > won't
> > > > exist.
> > >
> > > Gotcha. Thanks (to you and Janet... and whoever else reponds after
> > > this) for clarifying :)
> > >
> > > --
> > > Charlie Griefer
> > >
> > > ================================================
> > > "...All the world shall be your enemy, Prince with a Thousand Enemies,
> > > and whenever they catch you, they will kill you. But first they must
> > catch
> > > you, digger, listener, runner, prince with a swift warning.
> > > Be cunning and full of tricks and your people shall never be
> > destroyed."
> > >
> > >
> > >
> > >
> >
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285946
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4