|
nested structure problem
|
dweaton
|
Sep 14, 2005 12:46 PDT
|
I Need some help with nested structures.
I create the nested structure okay using the following code:
<cfset SESSION.indv = structNew()>
<cfloop
index="item"
list="#myList_ID#">
<cfquery
name="getIndvInfo"
datasource="#request.dsn#"
dbtype="#request.dsn_dbtype#"
username="#request.dsn_username#"
password="#request.dsn_password#">
SELECT #ATTRIBUTES.list_ID#_ID,
coEmail,
firstName,
lastName,
salutation
FROM #request.qPrefix##ATTRIBUTES.list_ID#List
WHERE #ATTRIBUTES.list_ID#_ID = #item#
</cfquery>
<!--- Create nested structures for each individual's info --->
<cfset indvID = item>
<cfset SESSION.indv["#indvID#"] = structNew()>
<cfset SESSION.indv["#indvID#"].firstName = "#getIndvInfo.firstName#">
<cfset SESSION.indv["#indvID#"].lastName = "#getIndvInfo.lastName#">
<cfset SESSION.indv["#indvID#"].salutation = "#getIndvInfo.salutation#">
<cfset SESSION.indv["#indvID#"].coEmail = "#getIndvInfo.coEmail#">
This creates a structure like so:
session.indv.indvID.firstName
session.indv.indvID.lastName
session.indv.indvID.email
session.indv.indvID.firstName
session.indv.indvID.lastName
session.indv.indvID.email
etc....
The 'Item' that gets passed in at the top is a list of indvID's - random numbers - used in the query to pull the right data. The indvID is the key to each nested structure.
I want to loop over the completed structure and retrieve all 3 elements for each nexted structure. How do I do this?
David
|
|
 |
|