In MX, you can do

<cfset variables[foo] = value>

Where foo is ID, this will make variables.id equal to value.

Before MX, you can use evaluate

<cfset foo = "id">
<cfset evaluate("#foo#=1")>
<cfoutput>#id#</cfoutput>

Although this is icky. ;) If I needed to set a bunch of dynamically
named vars prior to MX, I'd just make a struct:

<cfset mycrap = structNew()>

<cfset mycrap[foo] = value>

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Ryan Mitchell [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 21, 2003 5:51 AM
> To: CF-Talk
> Subject: naming a variable from another... 
> 
> 
> Hello
> 
> I need to name a variable using the value of another variable 
> in the name...
> 
> Eg
> 
> I have a variable called id and I want to do this
> 
> <cfset newvariable_#id# = value>
> 
> But it won't let me :)
> How do you do this?
> 
> TIA,
> Ryan
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to