I havent tried this but according to Michael Dinowitz it should be like
this:
Dynamic Variables
The Variable portion of a CFSET can be set dynamically by placing the text
portion within double quotes (") and surrounding the dynamic portion with
pound signs (#).
The Variable part of a CFSET does not need pound signs unless you're setting
a dynamic variable name, in which case it should be inside double quotes (")
as well.
Wrong: <CFSET #Name# = "Michael">
Right: <CFSET "#Name#" = "Michael">
When setting a dynamic Variable in a CFSET, remember to place the entire
Variable within double quotes (").
Wrong: <CFSET #varname# = "value">
Wrong: <CFSET var#name# = "value">
Right: <CFSET "#varname#" = "value">
Right: <CFSET "var#name#" = "value">
Regards.
----- Original Message -----
From: "Diana Nichols" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 12:07 PM
Subject: RE: Dynamic Variable Names
> Or, another solution is to reference #evaluate(qn)#, which will give you
the
> query result.
> D
> *************
> Diana Nichols
> Webmistress
> http://www.lavenderthreads.com
> 770.434.7374
>
> "One man's magic is another man's engineering." ---Lazarus Long
>
> -----Original Message-----
> From: Joshua Meekhof [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 04, 2001 1:38 PM
> To: CF-Talk
> Subject: Re: Dynamic Variable Names
>
>
> assuming that once you have retrieved the record the value of qn is no
> significant, try alias the value in the query:
> <CFQUERY NAME="get_results" DATASOURCE="datasource">
> SELECT #qn# as foo
> FROM database
> </CFQUERY>
>
>
>
> Jenny Anderson wrote:
> >
> > I want to dynamically create a variable name based upon a url variable.
> > First I set up a couple of strings:
> > <CFSET qs = 'q'>
> > <CFSET qn = #Insert(url.q, qs, 1)#>
> >
> > Where q is a number from 1-37 passed via url variable. Let's say that
> > url.q is 7. Then qn is 'q7'.
> > So I query the database like this:
> >
> > <CFQUERY NAME="get_results" DATASOURCE="datasource">
> > SELECT #qn#
> > FROM database
> > </CFQUERY>
> >
> > And it correctly pulls all the results from the 'q7' column. So far so
> good.
> > But now I want to be able to manipulate the query results and refer to
the
> > q7's from the database query. If I refer to #qn# I only get q7 as the
> > result. So how do I have it refer to the variable q7 and not the string
> q7?
> >
> > Thanks!
> >
> > Jenny
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists