Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting a Structure from within an Array 2

Status
Not open for further replies.

powahusr

Technical User
Jan 22, 2001
240
US
How do you extract a “Structure” that is inside of an Array container?

I am working with a container returned in the “returnvariable” attribute called “myQueryResult”.

<cfinvoke
component="cf_components.testcfc"
method="myFunction"
returnvariable="myQueryResult">

When I do a cfdump, inside of an array is a single record containing a Struct with the Key names of (UserID, Firstname, Lastname….) and their values. This is the result from a query in an invoked component.

I would like to do the following two tasks:

1) Extract the Structure(s) from the Array and display them.

2) Place these structures in their own collection so I can work with them more easily.


I’m a little rusty with my arrays; can you please help me out?

Thanks
 
what is the type of myQueryResult variable? array? and what it contains ?

-Angelos
 
try

<cfset tmp=duplicate(myqueryresult[1])>

that should extract the inner collection

here's a little snippet to create a structure like what I think you're describing and then extract the inside part

<cfset ar=arraynew(1)>
<cfset ar[1]=structnew()>
<cfset ar[1].x=1>
<cfdump var="#ar#">
<cfset tmp=duplicate(ar[1])>
<cfdump var="#tmp#">
 
Thanks guys, cleared the cobwebs off and figured it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top