Original Message:
From: Ryan Kime [EMAIL PROTECTED]
cfloop index=LoopCount from=1 to=12
cfset QuerySetCell(Monthly2003, month, curMonth, LoopCount)
cfset QuerySetCell(Monthly2003, dollar_amount,
qResults[valLoopCount], LoopCount)
/cfloop
The second QuerySetCell is what is killing me. It
Good question Scott, the recordcount of qResults will always be 1. FYI,
adding the [1] worked!
Thanks!
-Original Message-
From: Scott Brady [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 3:05 PM
To: CF-Talk
Subject: re: Dynamic variable names in QuerySetCell
Original
Here's the magic you need:
#evaluate(form.materiali)#
-Original Message-
From: Jen R [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 12:17 PM
To: CF-Talk
Subject: Dynamic Variable Names
In my database I have the fields material1, material2, material3,
I know you said you tried evaluate but in this case it would seem to be the way to go.
What was the output? Did you get the syntax wrong? Why is it that evaluate didn't
work for you?
Assuming there will always be at least one material
[psuedocode - you fill in the cf tags]
sql = insert
The problem you are having is because of the database structure. Those
materials fields need to be in a different table with another field that
relates to the project. Any time you have a 1 to Many relationship like
these 20 materials to 1 project, it cries out for two tables.
Here is some
evaluate is the least of your problems. lets start with the database. it is
not normalized. read : http://www.swynk.com/friends/putnam/normarticle.asp
for a better explanation. basically, whenever you find yourself making
column names that end with a number, you have a non-normalized table
How about
cfset thelist =
cfloop from=1 to=3 index=id
cfset thelist = ListAppend(thelist, Evaluate(form.fieldnum#id#))
/cfloop
Nick
-Original Message-
From: Andy Ewings [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 24, 2001 4:23 PM
To: CF-Talk
Subject: Dynamic variable names
yes you can do it. i use Evaluate() with dynamic values all the time.
try removing the from #id#. if that doesn't work (it should), try
something like:
cfset thelist =
cfloop from=1 to=3 index=id
cfset tempvalue = form.fieldnum#id#
cfset thevalue = Evaluate(tempvalue)
Email : [EMAIL PROTECTED]
ICQ UIN : 3679482
My ally is the Force, and a powerful ally it is. - Yoda
-Original Message-
From: Dylan Bromby [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 24, 2001 12:22 PM
To: CF-Talk
Subject: RE: Dynamic variable names
yes you can do it. i use
Try referring to it as get_results.#qn#
Steven Semrau
SRA International, Inc.
Senior Member, Professional Staff
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Com: (703) 805-1095
DSN: (703) 655-1095
-Original Message-
From: Jenny Anderson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001
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
:[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
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
#Evaluate(qn)#
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
You're trouble is you're not using the evaluate() function (and you're
using # gratuitously :).
cfset varname = evaluate("form.id" x)
This will now be the value of from.id1 instead of the string "form.id1"
(through whatever). There are other ways to handle this as well.
One
cfset rs = SetVariable("choice" count, blah)
Does rs have any special meaning or does it not matter?
No, it's a dummy variable. It stands for "return string". In fact, as has
been pointed out before, you could omit the left side of the CFSET, and it
would still work:
cfset
What's the best way to dynamically name variables used in a
CFSET tag?
I want them named choice0, choice1, etc up through however
many loops are made:
CFSET choice#count# = blah (which does not work but
illustrates what I'm trying to do.
As many people have already pointed out, you
Does rs have any special meaning or does it not matter?
jon
cfset rs = SetVariable("choice" count, blah)
Of those two, I'd recommend the second, simply because it will be
supported
in future versions of CF, while the first one may not be.
However, you might consider using a
This code works:
cfset "choice#count#" = blah
-Original Message-
From: David Shadovitz [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 03, 2000 12:39 AM
To: CF-Talk
Subject: Re: Dynamic Variable Names in a CFSET
cfset tmp = SetVariable("choice#count#", blah)
-
Check EVALUATE and DE functions
Gennadi
- Original Message -
From: "David Hannum" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Friday, November 03, 2000 3:06 PM
Subject: Dynamic Variable Names in a CFSET
Hello,
What's the best way to dynamically name variables used in a
cfset "choice#count#" = blah
-Original Message-
From: David Hannum [mailto:[EMAIL PROTECTED]]
Sent: Friday, 3 November 2000 15:06
To: CF-Talk
Subject: Dynamic Variable Names in a CFSET
Hello,
What's the best way to dynamically name variables used in a CFSET tag?
I want
just set a loop from n to n to populate..(cfloop).. Hope that shoots you
in the rite direction..
G. Scott Wood
Developer
HMWeb.com
520-742-2611 Ext.135
-Original Message-
From: David Hannum [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 02, 2000 9:06 PM
To: CF-Talk
Subject:
Dave, you're real close. Just do
CFSET "choice#count#" = blah
There's also the SetVariable() function that can be used to do the same thing (check
the docs). I'm not sure there's much of an advantage to either way of doing it. I
believe the above example only works with CF4 and up, while
Try:
CFSET "choice#count#" = blah
Norman Elton
Information Technology
College of William Mary
-Original Message-
From: David Hannum [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 02, 2000 11:06 PM
To: CF-Talk
Subject: Dynamic Variable Names in a CFSET
Hello,
What's the best
cfset tmp = SetVariable("choice#count#", blah)
-David
On Thu, 2 Nov 2000 23:06:20 -0500 "David Hannum"
[EMAIL PROTECTED] writes:
Hello,
What's the best way to dynamically name variables used in a CFSET
tag?
I want them named choice0, choice1, etc up through however many
loops are
25 matches
Mail list logo