title: List Not Being Read Correctly in ColdFusion 8
body: <p>Using CFSEARCH I have the key variable contained as a comma-separate list to return more information than the four custom fields allow. However, the system is throwing an error saying that the list items cannot be found.</p>
  <p>Each record of &quot;key&quot; variable will have the following format: a,b,c</p>
  <pre><code>&lt;cfsearch
    name=&quot;theCourses&quot;
    collection=&quot;#arguments.collectionName#&quot;
    type=&quot;simple&quot;
    startrow=&quot;1&quot;
    maxrows=&quot;100&quot;
    criteria=&quot;#Lcase(Trim(arguments.searchCriteria))#&quot;
    contexthighlightbegin=&quot;&lt;b&gt;&quot;
    contexthighlightend=&quot;&lt;/b&gt;&quot;
    status=&quot;courseListStatus&quot;
  /&gt;
  
  &lt;cfset courseList = QueryNew(&quot;ID, Score, Course, Subject, Day, Title, Semester, Status&quot;, &quot;varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar&quot;) /&gt;
  &lt;cfloop query=&quot;theCourses&quot;&gt;
    &lt;cfset temp = QueryAddRow(courseList) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;ID&quot;, custom3) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Score&quot;, score) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Course&quot;, ListGetAt(key, 2, &quot;,&quot;)) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Subject&quot;, ListFirst(key, &quot;,&quot;)) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Day&quot;, custom1) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Title&quot;, custom4) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Semester&quot;, custom2) /&gt;
    &lt;cfset temp = QuerySetCell(courseList, &quot;Status&quot;, ListLast(key, &quot;,&quot;)) /&gt;
  &lt;/cfloop&gt;
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>Invalid list index 2.</p>
  <p>In function ListGetAt(list, index [, delimiters]), the value of index, 2, is not a valid as the first argument (this list has 1 elements). Valid indexes are in the range 1 through the number of elements in the list.</p>
  </blockquote>