Yes you can.

1  <cfset v_var_name = "foo">
2  <cfset "Request.#v_var_name#" = "bar">
3  <cfoutput>
4  #Request.foo#<br>
5  <cfset v_tmp = Evaluate("Request.#v_var_name#")>
6  #v_tmp#
7  </cfoutput>

Setting the variable is easy, you just make the left side of the equation an
expression to be evaluated (line 2). Outputting the variable is a little
harder. If you know the name of the variable, you can just reference it
directly (line 4). If you don't, then you'll need to first dereference it
into a temporary variable using the Evaluate() function (line 5) and then
output it as a second step. You have to do it this way because you can't put
pound signs around an Evaluate() function that has an expression to be
evaluated as its parameter. In other words you can't nest expressions in CF
but that is fine because we can just do it in two steps as I've demonstrated
above.

-Chris Gilbert, Fodors.com


-----Original Message-----
From: kaigler [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 11:00 AM
To: CF-Server
Subject: easy one


is this possible?

cfoutput
cfset field#x# = '#somevalue#'
/cfoutput

I am in a cfloop.  I want to create a field named field#x# for the loop 
occurrence I am in.

Here is the error:
Invalid parser construct found on line 123 at position 20. ColdFusion was 
looking at the following text:#Invalid expression format. The usual cause 
is an error in the expression structure.


thanks,
kaigler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with 
'unsubscribe' in the body or visit the list page at www.houseoffusion.com

Reply via email to