What about arrayLen?

If someArrayIndex lte arrayLen(theArray)
   Do stuff

-----Original Message-----
From: Derek Hedstrom [mailto:[email protected]] 
Sent: Monday, December 07, 2009 3:53 PM
To: cf-newbie
Subject: testing existence of array element


Help!

I need to compare the value of an array element to another value, but the
array element may not always exist. How can I check for this?

I have tried ArrayIsDefined(), and IsDefined().

ArrayIsDefined() gives me the following error:
<cfoutput>#ArrayIsDefined(arSelected,3)#</cfoutput>
Cannot access array element at position 3.
The array has 2 indexes. Valid positions are from 1 to 2. 

Yeah, duh! That's what I am trying to find out!

IsDefined doesn't seem to like array notation:
<cfoutput>#IsDefined("arSelected[1]")#</cfoutput>
Parameter 1 of function IsDefined, which is now arSelected[1], must be a
syntactically valid variable name. 

TIA,
Derek



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4914
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to