> I am trying to set a variable indirectly, i.e., I have 
> a variable that contains the name of the variable I want 
> to set. How do you accomplish this?

You can use the SetVariable function, or use a string within a CFSET:

<cfset myvar = "foo">
<cfset rs = SetVariable(myvar, "foovalue")>

or

<cfset "#myvar#" = "foovalue">

Or, if you're using a newer version of CF, and the scope within which you
want to set the variable is a structure, you can use array syntax:

<cfset Session[myvar] = "foovalue">

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to