Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8628437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:32:37+00:00 2026-06-12T08:32:37+00:00

Using CFSEARCH I have the key variable contained as a comma-separate list to return

  • 0

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.

Each record of "key" variable will have the following format: a,b,c

<cfsearch
  name="theCourses"
  collection="#arguments.collectionName#"
  type="simple"
  startrow="1"
  maxrows="100"
  criteria="#Lcase(Trim(arguments.searchCriteria))#"
  contexthighlightbegin="<b>"
  contexthighlightend="</b>"
  status="courseListStatus"
/>

<cfset courseList = QueryNew("ID, Score, Course, Subject, Day, Title, Semester, Status", "varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar") />
<cfloop query="theCourses">
  <cfset temp = QueryAddRow(courseList) />
  <cfset temp = QuerySetCell(courseList, "ID", custom3) />
  <cfset temp = QuerySetCell(courseList, "Score", score) />
  <cfset temp = QuerySetCell(courseList, "Course", ListGetAt(key, 2, ",")) />
  <cfset temp = QuerySetCell(courseList, "Subject", ListFirst(key, ",")) />
  <cfset temp = QuerySetCell(courseList, "Day", custom1) />
  <cfset temp = QuerySetCell(courseList, "Title", custom4) />
  <cfset temp = QuerySetCell(courseList, "Semester", custom2) />
  <cfset temp = QuerySetCell(courseList, "Status", ListLast(key, ",")) />
</cfloop>

I get the following error:

Invalid list index 2.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:32:38+00:00Added an answer on June 12, 2026 at 8:32 am

    I’m afraid your assertion that the key will be of the format “a,b,c” is clearly mistaken in this particular case. Otherwise your code would work!

    So, as with any “why does this not have the value I expect?” situation, when the thing errors, dump out the value that’s contributing to the error, and eyeball what’s wrong with it.

    In this case:

    <cftry>
        <cfset temp = QuerySetCell(courseList, "Course", ListGetAt(key, 2, ",")) />
        <cfcatch>
            <cfoutput>#key#</cfoutput>
            <cfdump var="#cfcatch#">
            <cfabort>
        </cfcatch>
    </cftry>
    

    Also: you do not need to set the temp variable on the LHS of that expression if you’re not going to use it (which as it will always be “yes”, I suspect you won’t need. This is fine:

    <cfset QuerySetCell(courseList, "Course", ListGetAt(key, 2, ",")) />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a search working that combines the results of multiple cfsearch'es using categories.
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using MVC2 I have an AJAX form which is posting to a bound model.
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
Using Core Data, I have a fetch request to fetch the minimum of a
Using Java,I have to fetch multiple sets of values from an XML file to
Using MVVM. I have a DataTemplate which I am using to display an expander
using chrome and ff so far have made a nasty glitch when using scrollTo
Using RestKit 0.10.1, I have objects served similar to this json format: {objects: [
How to fill up the AutoCompleteCustomSource List with the query results using Data reader

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.