<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="http://livedocs.adobe.com/">
	<title>LiveDocs Comments - coldfusion - 6.1 - htmldocs - functia7.htm</title>	
		<link>http://livedocs.adobe.com/</link>
		<description>Macromedia LiveDocs - online documentation with user feedback.</description>
		<copyright>Copyright 2009, Macromedia, Inc.</copyright>
		<dc:date>2009-11-26T07:08:42</dc:date>
		<dc:language>en-us</dc:language>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72590" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72588" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72553" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#26512" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#12457" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#12276" />
			</rdf:Seq>
		</items>
	</channel>
	
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72590">
		<title>coldfusion/6.1/htmldocs/functia7.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72590</link>
		<description>I forgot to mention in my last note: In ColdFusion 8 we added an ArrayIsDefined(array, index) function that tests the existence of an array element. So in ColdFusion 8 you can avoid the try/catch block as follows:&lt;br /&gt;&lt;br /&gt;&lt;cfset myArray = ArrayNew(1)&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfset myArray[1] = &quot;hi&quot;&gt;&lt;br /&gt;&lt;cfset myArray[6] = &quot;bye&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfoutput&gt;&lt;br /&gt;Array Length: #ArrayLen(myArray)#&lt;br&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;	&lt;cfloop index=&quot;i&quot; from=&quot;1&quot; to=&quot;#Arraylen(myArray)#&quot;&gt;&lt;br /&gt;		&lt;cfif ArrayIsDefined(myArray, i)&gt;&lt;br /&gt;			#i#: #myArray[i]#&lt;br&gt;&lt;br /&gt;		&lt;/cfif&gt;&lt;br /&gt;	&lt;/cfloop&gt;&lt;br /&gt;&lt;/cfoutput&gt;</description>
		<dc:creator>halL</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2007-08-24T06:54:08</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72588">
		<title>coldfusion/6.1/htmldocs/functia7.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72588</link>
		<description>In response to TinMan75:&lt;br&gt;&lt;br&gt;ColdFusion arrays are sparse. &lt;br&gt;If you don't assign a value to an array elment, the element does not exist.&lt;br&gt;Unfortunately, you cannot use IsDefined to test the existence of an element.&lt;br&gt;Instead, use a try catch block, as in the following example, which I tested on CF 7 and 8, but not 6.1.&lt;br&gt;&lt;br&gt;&lt;cfset array1 = ArrayNew(1)&gt;&lt;br&gt;&lt;br&gt;&lt;cfset array1[1] = &quot;hi&quot;&gt;&lt;br&gt;&lt;cfset array1[6] = &quot;bye&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;cfoutput&gt;&lt;br&gt;Array Length: #ArrayLen(array1)#&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/cfoutput&gt;&lt;br&gt;&lt;br&gt;&lt;cfloop index=&quot;i&quot; from=&quot;1&quot; to=&quot;#Arraylen(array1)#&quot;&gt;&lt;br&gt;&lt;!--- &lt;cfif isDefined(&quot;array1[2]&quot;)&gt; ---&gt;&lt;br&gt;&lt;cfoutput&gt;&lt;br&gt;&lt;cftry&gt;&lt;br&gt;#i#: #array1[i]#&lt;br&gt;&lt;br&gt;&lt;cfcatch type=&quot;any&quot;&gt;&lt;br&gt;undefined&lt;br&gt;&lt;br&gt;&lt;/cfcatch&gt;&lt;br&gt;&lt;/cftry&gt;&lt;br&gt;&lt;/cfoutput&gt;&lt;br&gt;&lt;/cfloop&gt;</description>
		<dc:creator>halL</dc:creator>
		<dc:type>1 1</dc:type>
		<dc:date>2007-08-24T06:34:06</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72553">
		<title>coldfusion/6.1/htmldocs/functia7.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#72553</link>
		<description>If i try to access an array element that is in between 1 and 6 i will get a &lt;br /&gt;&lt;br /&gt;&quot;Element 2 is undefined in a Java object of type class coldfusion.runtime.Array referenced as &quot;&lt;br /&gt;&lt;br /&gt;error. How do i check to see if there is a value there or not? CF doesn't init these empty elements to null? &lt;br /&gt;&lt;br /&gt;As you can see the array length returns 6. If i try to loop over the array an error will occur. &lt;br /&gt;&lt;br /&gt;&lt;cfset array = ArrayNew(1)&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfset array[1] = &quot;hi&quot;&gt;&lt;br /&gt;&lt;cfset array[6] = &quot;bye&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfoutput&gt;&lt;br /&gt;		#ArrayLen(array)#&lt;br /&gt;&lt;/cfoutput&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfloop index=&quot;i&quot; from=&quot;1&quot; to=&quot;#Arraylen(array)#&quot;&gt;&lt;br /&gt;	&lt;cfoutput&gt;&lt;br /&gt;		#array[i]#&lt;br /&gt;	&lt;/cfoutput&gt;&lt;br /&gt;&lt;/cfloop&gt;</description>
		<dc:creator>TinMan75</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2007-08-23T12:58:30</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#26512">
		<title>coldfusion/6.1/htmldocs/functia7.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#26512</link>
		<description>&quot;Array elements whose indexes are greater than the new position are incremented by one&quot;&lt;br /&gt;&lt;br /&gt;should read&lt;br /&gt;&lt;br /&gt;&quot;Array elements whose indexes are greater than or equal to the new position are incremented by one&quot;&lt;br /&gt;&lt;br /&gt;otherwise it's unclear whether inserting at x inserts before or after the current element at x.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Robin</description>
		<dc:creator>Robin Hilliard</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-01-13T17:33:25</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#12457">
		<title>coldfusion/6.1/htmldocs/functia7.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#12457</link>
		<description>As a general rule, ColdFusion Arrayxxx functions (with the exception of ArrayNew) work on one dimensional of arrays or one dimension of a multidimensional array.&lt;br&gt;To apply the ArrayInsert function to a multidimensional array, you must specify all but the last index in the first paramaeter.&lt;br&gt;For example, the following code inserts an element at myarray[2][4]:&lt;br&gt;&lt;br&gt;&lt;cfset arrayInsertAt(myarray[2], 4, &quot;test&quot;)&gt; &lt;br&gt;&lt;br&gt;Also, please note that the following statement in the Description section is inaccurate: &lt;br&gt;&lt;br&gt;&quot;Array elements whose indexes are greater than the new position are incremented by one.&quot;&lt;br&gt;&lt;br&gt;The correct statement is&lt;br&gt;&lt;br&gt;&quot;Array elements whose indexes are equal to or greater than the new position are incremented by one.&quot;&lt;br&gt;&lt;br&gt;This is shown by the following code:&lt;br&gt;&lt;br&gt;&lt;cfscript&gt;&lt;br&gt;myarray=arraynew(2);&lt;br&gt;myarray[2][4]=&quot;original element 2,4&quot;;&lt;br&gt;myarray[2][5]=&quot;original element 2,5&quot;;&lt;br&gt;&lt;/cfscript&gt;&lt;br&gt;&lt;cfdump var=&quot;#myarray#&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;cfset arrayinsertat(myarray[2], 4, &quot;inserted element 2,4&quot;)&gt;&lt;br&gt;&lt;cfdump var=&quot;#myarray#&quot;&gt;</description>
		<dc:creator>halL</dc:creator>
		<dc:type>1 1</dc:type>
		<dc:date>2004-04-06T07:30:10</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#12276">
		<title>coldfusion/6.1/htmldocs/functia7.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm#12276</link>
		<description>How do you insert into a 2D array with arrayinsertat ?</description>
		<dc:creator>RogerDogerCF</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-04-02T16:30:59</dc:date>
	</item>
	</rdf:RDF>

