Have you considered using structures instead of arrays? I often use structs
when the data is sparse (i.e. when many or most array indices don't have a
value assigned).

myArray = structNew();
myArray[someVar] = structNew();
...
if ( structKeyExists(myArray, someVar) and structKeyExists(myArray[someVar],
i) )
  do something with myArray[someVar][i]...


> -----Original Message-----
> From: Tyler [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, 10 November 2004 12:52 p.m.
> To: CF-Talk
> Subject: Anyway to detect is an array's element is defined?
> 
> Is there anyway to check if an array's value is defined 
> without using a try/catch statement?
>  
> I'm creating a calendar array for a good amount of years, and 
> it's killing my processing time to wrap a cftry around each 
> and every call after adding just a couple array elements 
> (which then creates all the other un-defined elements "below" 
> the current element.) 
>  
> IsDefined(), or probably #IsDefined("myArray[" & somevar & 
> "][" & i & "]")#, isn't working either.  I can tell that 
> myArray[somevar] exists and is an array, but when "i" is 
> pointing to an undefined array element, I can't tell without 
> throwing an error...argghhh.
>  
> Tyler
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183821
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to