Welcome Guest!
 Fuseboxers
 Previous Message All Messages Next Message 
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
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.