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 6581059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:06:18+00:00 2026-05-25T16:06:18+00:00

I am trying to reference a query from an array and use it in

  • 0

I am trying to reference a query from an array and use it in a cfloop tag and I keep getting an error

Error:

The expression has requested a variable or an intermediate expression result as a simple value. However, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.

The most likely cause of the error is that you tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.

Code:

<cfquery datasource="datasource" name="valueQuery">SELECT count FROM watermelons</cfquery>
<cfset queryArray = ArrayNew(1)>

<cfscript>
ArrayAppend(queryArray, valueQuery);
</cfscript>

<cfloop query="#queryArray[1]#">
        <!---do stuff--->
</cfloop>

I have also tried (without the pounds):

<cfloop query="queryArray[1]">
            <!---do stuff--->
</cfloop>

which gives this error:

The value of the attribute query, which is currently queryArray[1], is invalid.

  • 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-05-25T16:06:18+00:00Added an answer on May 25, 2026 at 4:06 pm
    <cfset queryIndex = queryArray[1]>
    <cfloop query="queryIndex">
            <!---do stuff--->
    </cfloop>
    

    ’cause query="" expects a variable name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a Can't use an undefined value as a HASH reference error trying
Trying to use an excpetion class which could provide location reference for XML parsing,
I am trying to use stored procedure in dbml, but I get below error.
I am trying to reference an array through a function I am calling $bio['results']
I'm trying to reference a field from the 1st select table in the 3rd
Am trying to pass an array of values from PHP function to Javascript. Not
I am trying to reference the jQuery library in my master page like so:
We are trying to reference a certificate for a client endpoint configuration in our
I am trying to reference some child entities with part of the parents composite
In the below code, i am trying to reference an external .dll, which creates

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.