Subsribe to our RSS

latest reactions

Joshua Giese
wow, very simple. I was going to use a U …
up set
I think its a .... shame that Adobe ship …
vacuum cleaners
The dateformat thing often upsets me. Mo …
Phyllis
Hello Dav, Gary, and Tjarko, ... Thank y …
Tjarko
This one doesn't load either, aarghhh @G …

mxna feeds

understanding flex data management by using coldfusion livecycleCFConversations 6, Interview 2 - Michael Smith of Teratech - 07/05/08Jacksonville Code Camp Needs SponsorsTweetDeck, The Next Step In My Twitter AddictionWhy Can't I Run More Than One Server Instance at the Same Time?Learn about ColdFusion 8 in your backyard (free eseminars)How to decrypt Coldfusion datasource passwordsMore Thoughts On MVC, OOP, And Form Submissions In ColdFusionPoor Man's HTTP Compression with ColdFusionWormhole for Connecting Flex and ColdFusionIntro: HTML to Flex in a matter of daysGot cookies? (in your logs)4 ColdFusion Webinars In JulyTom Jordahl Rocks! - How to consume web services in ColdFusionColdFusion Event Gateway Reference

All files are strictly confidential: all information is classified.
© Copyright 2002 - 2008 mximize.com.
All right reserved.

MXNA webfeed

Visit Carlos GallupaPowered by ColdFusion MX 7.01

How to set a dynamic variable name?

<cfloop from="1" to="10" index="i">
 <cfset "request.var_#i#" = i>
</cfloop>

<cfdump var="#request#">

2096 viewed | 4 opinion(s)  | del.icio.us | Digg it | Tjarko @ 13/11/02 0:00 cet


Reactions:

Eran Magen wrote.... (site)

Thanks a bunch! I've been wrestling with this for the last ~30 minutes, and a little pair of quotes was all I was missing... :-)

Take care,

- Eran

21 October 2007 6:25 cet  

Maija Johnstone wrote.... (site)

To create a dynamic variable name you need to use evaluate().This function lets you concatenate variables and/or strings to create a variable name and then evaluates that variable to its value.

12 November 2007 19:11 cet  

Tjarko wrote.... (site)

I'm sorry Maija, but you should never ever user evaluate() It's a total overload for coldfusion. The best way is the way described above, this has no impact on performance and the evaluate() function is really bad for performance. Please don't ever use this function again, or be very very sure that you absolutly have to.

12 November 2007 20:02 cet  

Cougar wrote.... (site)

simple quotes, I'm amazed.CF continues to amaze me with its power.Thank you for posting this.Your solution was the first link in Google with the following: coldfusion set variable in a variable name

16 May 2008 16:49 cet  

Leave your comment

Your name


Your url/website/link/email....


Some room for your reaction is placed here..



A dozen apples are how many?? (12 would be a good answer for this)




URL en mail addresses are translated for you... life sometimes is that simple!!
hp