Adrian,

I would really use either a Structure or Array for this - its really the 
ideal application for these more complex data types.

Here's how you could use a Structure:

<cfset Cities = StructNew()>

<cfset Cities = StructInsert(Cities, "Atlanta", AtlantaList)>
<cfset Cities = StructInsert(Cities, "Dallas", DallasList)>

A specific city's list is available by referencing:
Cities["Atlanta"] or Cities["Dallas"]

<cfoutput>
Atlanta - #Cities["Atlanta"]#<br>
Dallas - #Cities["Dallas"]#<br>
</cfoutput>

<CFLOOP COLLECTION=#Cities# ITEM="TheCity">

<!---
This loop will loop over all of the city names you have set up as structure 
keys;
within this loop each city specific list is available by referencing:
         Cities[TheCity]
--->
<cfoutput>
#TheCity# - #Cities[TheCity]#<br>
</cfoutput>

</cfloop>

I didn't test this - so buyer beware!
Kevin


At 09:49 AM 7/7/00 -0700, you wrote:
>Im having a problem linking a variable name to a list name, and cant figure
>out a way around this.  Basically I have a List of Cities and each City in
>the Cities List has its own List.  I have 2 loops, the outer loop processes
>one City at a time and the inner loop process's the list for the current
>city.
>
>This is the code Im basically using (trimmed down), the Cities and Cities
>Names Lists are dynamic and will vary based on other queries:
>
>
><cfset Cities = "Atlanta,Dallas">
><cfset Atlanta = "AB1,AB2,AB3,AB4">
><cfset Dallas = "DB1,DB2,DB3,DB4,DB5,DB6,DB7">
>
>
>
><cfset Loop1Count = 1>
><cfloop index="i1" from="1" to="#ListLen(Cities)#">
><cfset SingleCity = listgetat(Cities, #Loop1Count#)>
>
>
><cfset SingleCityList = #SingleCity#)>
><!--- I need to somehow connect the City with it associated list.  I know
>this does not work, SingleCityList ends up being Atlanta rather than the
>Atlanta List (AB1,AB2,AB3,AB4).
>--->
>
>
><cfloop index="i2" from="1" to="#ListLen(singlecitylist)#">
>
>Do some processing
><!--- I need to have the Atlanta List available in this loop for
>processing --->
>
></cfloop>
>
>
><cfset Loop1Count = Loop1Count +1>
></cfloop>
>
>
>There must be some way around this, Ive tried putting the lists into an
>Array (Im new to arrays) but a had a problem because each list was not the
>same length.  Any recommendations on how to accomplish this...?
>
>Thanks,Adrian

--------------------------
Kevin Marshall
Web Application Developer
eCalton.com, Inc.
Vero Beach, FL
www.ecalton.com
[EMAIL PROTECTED]
561.569.4500

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to