<cfloop index="i" from="0" to="20">
<cfset innerVal = ''>
<cfloop index="j" from="0" to="#i#">
<cfset innerVal = innerVal & '"#j#|#j#"'>
<cfif j NEQ i>
<cfset innerVal = innerVal & ", ">
</cfif>
</cfloop>
sidewalls_Quantity[#i#]=[#innerVal#]<br />
</cfloop>
Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE 68154
http://www.cfwebtools.com
402-408-3733 x103
-----Original Message-----
From: Paul Ihrig [mailto:[email protected]]
Sent: Thursday, May 14, 2009 8:47 AM
To: cf-talk
Subject: dynamically create array using cfloop?
hey guys i have an array like below to render a 2nd select box based
on first select box
it continues 0-20
var sidewalls_Quantity#rsTS8.specs_partnum#=new Array()
sidewalls_Quantity#rsTS8.specs_partnum#[0]=["0|0"]
sidewalls_Quantity#rsTS8.specs_partnum#[1]=["0|0", "1|1"]
sidewalls_Quantity#rsTS8.specs_partnum#[2]=["0|0", "1|1", "2|2" ]
sidewalls_Quantity#rsTS8.specs_partnum#[3]=["0|0", "1|1", "2|2", "3|3"]
sidewalls_Quantity#rsTS8.specs_partnum#[4]=["0|0", "1|1", "2|2", "3|3" ,
"4|4"]
i would like to just use cfloop to populate it and make maller code..
<cfloop index="i" from="0" to="20">
sidewalls_Quantity[#i#]=["#i#|#i#"]<br />
</cfloop>
outputs
sidewalls_Quantity[0]=["0|0"]
sidewalls_Quantity[1]=["1|1"]
sidewalls_Quantity[2]=["2|2"]
sidewalls_Quantity[3]=["3|3"]
sidewalls_Quantity[4]=["4|4"]
sidewalls_Quantity[5]=["5|5"]
sidewalls_Quantity[6]=["6|6"]
which is close. but i think i need another loop to do the "0|0",
"1|1", "2|2", "3|3"
stuff..
any ideas..
thanks a ton!
-paul
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322497
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4