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

  • SEARCH
  • Home
  • 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 7644917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:48:19+00:00 2026-05-31T09:48:19+00:00

I have the following array with a structure within each array (see this jsfiddle

  • 0

I have the following array with a structure within each array (see this jsfiddle for what the array looks like).

How do I loop over the array, then get the structure within the array to pull out the userid? I keep getting errors with variations that I’ve tried. The most common error I’m getting is:

Must be a valid structure or COM object

Here is the code I have to loop over the array and structure that is generating the error above (see this jsfiddle for what the array looks like).

<cfloop from="1" to="#ArrayLen(getTeamDetails)#" index="s">
    #s#) #getTeamDetails[s][uid]#<br>   
</cfloop> 

Mark asked for some more code so I’ve included how I’m populating the array/structure:

<cfoutput query="getTeam">
    <cfset getTeamDetails[getTeam.currentrow] = StructNew()>
    <cfset a = StructInsert(getTeamDetails[getTeam.currentrow], "firstname", getTeam.firstname, 1)>
    <cfset a = StructInsert(getTeamDetails[getTeam.currentrow], "lastname", getTeam.lastname, 1)>
    <cfset a = StructInsert(getTeamDetails[getTeam.currentrow], "uid", getTeam.uid, 1)>
</cfoutput>
  • 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-31T09:48:21+00:00Added an answer on May 31, 2026 at 9:48 am

    I think this should work:

    <cfloop from="1" to="#ArrayLen(getTeamDetails)#" index="s">
        #s#) #getTeamDetails[s].uid#<br>   
    </cfloop> 
    

    I created your array and structure from scratch and loop through it to access the structkey you need to access.

    <cfscript>
    ThisArray = arrayNew(1);
    for (i = 1; i lte 3; i=i+1) {
        ThisStruct = structNew();
        ThisStruct.UID = "123";
        arrayAppend(ThisArray, ThisStruct);
    }
    for (i = 1; i lte arrayLen(ThisArray); i=i+1) {
        ThisOutput = "#i#) #ThisArray[i].UID# <br>";
        writeOutput(ThisOutput); 
    }
    </cfscript>
    <cfdump var="#ThisArray#">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array called $all_countries following this structure: Array ( [0] => Array
I have a backbone collection Platforms . The structure of Platforms looks like this:
I have the following link structure for my portfolio: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' =>
I have a data structure that looks like Array ( [0] => Array (
I have an array structure like the following: I would like to have the
I have the following array structure: Array ( [0] => Array ( [configuration_id] =>
I have the following array structure (linked list): struct str_pair { char ip [50]
I have the following array structure in MySQL. There could be no items or
I have the following array structure: [[a], [b, c, [d, e]]] That could have
I have the following code with a structure array with data to make some

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.