> How can I assemble an CFML command inside a string and execute it?
>
> For example, If I had the following CFML code, what would be
> the next line to actually cause the variable "somevalue" to be
> created and assigned a value of 3?
>
> <cfset myString = "<CFSET somevalue=3>">
>
> I have a table with two columns called "variableName" and
> "variableValue". I'd like to loop through the set and make sure
> all the variables get their assigned values.
>
> I could have sworn I made this happen before, but I just can't seem
> to remember how. I've tried the #evaluate()# function, but you can't
> do something like <CFSET #evaluate("variableName")# =
> #evaluate("variableValue")#> because the left side of an equation can't
> be a function, according to the CF rules.

Keep in mind that you can't evaluate CFML tags, only CFML expressions. That
said, you can create a bunch of variables by looping over your query and
using the SetVariable function:

<CFLOOP QUERY="myquery">
        <CFSET rs = SetVariable(myquery.variableName, myquery.variableValue)>
</CFLOOP>

However, the more interesting question (to me, anyway) is why you'd want to
do this! If you have a query, why not just reference its data as needed?

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

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to