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 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
RE: naming a variable from another...
Try cfset newvariable_#id# = value Steve -Original Message- From: Ryan Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7: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
RE: naming a variable from another...
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
Re: naming a variable from another...
cfset setvariable(newvariableid,value) which reads better in cfscript or cfset variables[newvariableid] = value umm... I'm sure there are other ways too, just don't use evaluate() ;o) Stephen - Original Message - From: Ryan Mitchell [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 12:50 PM 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
RE: naming a variable from another...
cfset newvariable_#id# = value -Oorspronkelijk bericht- Van: Ryan Mitchell [mailto:[EMAIL PROTECTED] Verzonden: do 21/08/2003 13:50 Aan: CF-Talk CC: Onderwerp: 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 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
RE: naming a variable from another...
Take a look at the setVariable() function. Jeff Sarsoun -Original Message- From: Ryan Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7: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
RE: naming a variable from another...
You wouldn't even need the evaluate for this. cfset setVariable('newvariable' id,value) Jeff Sarsoun -Original Message- From: Michael T. Tangorre [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 10:02 AM To: CF-Talk Subject: Re: naming a variable from another... Try this.. SetVariable(Evaluate('newvariable' id),value) Mike - Original Message - From: Ryan Mitchell [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:50 AM 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 Get the mailserver that powers this list at http://www.coolfusion.com
naming a variable from another...
Hi Ryan, You have lots of options: cfset newvariable_#id# = value or cfset SetVariable( newvariable_#id#, value ) ...and I am sure there are plenty more options out there. Of the two choices above, the first one is the best-performing. Good day Mike Mertsock Alfred University Web Team 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 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
RE: naming a variable from another...
cfset newvariable_#id# = value -Original Message- From: Ryan Mitchel Sent: 21 August 2003 12:51 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? ~| 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 Get the mailserver that powers this list at http://www.coolfusion.com
Re: naming a variable from another...
Try this.. SetVariable(Evaluate('newvariable' id),value) Mike - Original Message - From: Ryan Mitchell [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:50 AM 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
RE: naming a variable from another...
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. ;) Icky? Ah, a technical term. jk ~| 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 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm