Not really knowing what you are trying to do, I think you want to do
something like the following. If you just cut an paste this into a cfm
template you can see how it works...
To do this in list form...<br>
<cfset cities = "atlanta,dallas,great falls,seattle,los angeles">
<!--- you need a list for the cityname using a space as a delimeter and list
for the parsed city names because some names might have spaces that would
screw everything up --->
<cfset parsedcitylist = "">
<cfset cityname = "">
<!--- outer loop is the cities --->
<cfloop index="i" list="#cities#">
<!--- query that the data is coming from --->
<cfquery name="places" datasource="test1">
select location
from places
Where cities = '#i#'
</cfquery>
<!--- make a list out of the city name using a space as the delimeter --->
<cfloop index="citypart" list="#i#" delimiters=" ">
<cfset cityname = listappend(cityname, citypart)>
</cfloop>
<!--- concatenate the city name --->
<cfloop index="citypartpos" from="1" to="#listlen(cityname)#">
<cfif citypartpos is 1>
<cfset cityparsed = listgetat(cityname, citypartpos)>
<cfelse>
<cfset cityparsed = cityparsed & "_" &listgetat(cityname, citypartpos)>
</cfif>
</cfloop>
<!--- make a list of parsed cities which would have the same number of
elements of the original list--->
<cfset parsedcitylist = listappend(parsedcitylist, cityparsed)>
<!--- rename the index to the parsed city name --->
<!--- dynamically set a variable with the associated data --->
<cfset "#cityparsed#" = valuelist(places.location)>
<!--- clear the city name variable--->
<cfset cityname = "">
</cfloop>
<!--- Now you have a bunch of dynamically set variables that contain a bunch
of locations. --->
<br>
<br>
<!--- use the length of the cities list as the length of your loop --->
<!--- evaluate the item in the parsedcitylist list to get its dynamically
set value --->
<cfloop index="i" from="1" to="#listlen(cities)#">
<cfoutput>
The locations for #listgetat(cities, i)# are
#evaluate("#listgetat(parsedcitylist,i)#")#.<br>
</cfoutput>
</cfloop>
<br>
Alternatively if you needed an array....
<cfset cities = "atlanta,dallas,great falls,seattle,los angeles">
<!--- declare the array --->
<cfset sean = arraynew(2)>
<cfloop index="i" from="1" to="#listlen(cities)#">
<!--- Whatever your associating with the states, I am assuming its a
query --->
<cfquery name="places" datasource="test1">
select location
from places
Where cities = '#listgetat(cities, i)#'
</cfquery>
<!--- dynamically set a variable with the associated data --->
<cfset "state_#i#" = valuelist(places.location)>
<!--- use the index variable as the row count of your array --->
<!--- put the city in the first position of the current row --->
<cfset sean[i][1] = listgetat(cities, i)>
<!--- put the associated data in the second position of the current
row --->
<cfset sean[i][2] = evaluate("state_#i#")>
</cfloop>
<br>
To output the array
<br>
<cfloop index="i" from="1" to="#arraylen(sean)#">
<cfoutput>
The location's for #sean[i][1]# are #sean[i][2]#<br>
</cfoutput>
</cfloop>
If you email me exactly what you are trying to do I could give you a more
percise example.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.