Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

double?? dynamic variable name....

Status
Not open for further replies.

sliver

Programmer
Nov 16, 2000
23
US
ok I am completely stumped in the middle of an loop fed by a query I have a set variable I am doing another query inthe loop to get numbers of record with certian variables (happens like 60 times on the page and I dont want to make a new query everytime we add one) so here is what I am trying to set.

<cfset #new#numb="#dude.recordcount#">

the variable #new# will be a name and I want the new variable to be #namenumb# so I can call it later inthe page for a rowspan in a table... I hope this is well enough explained I have been beating my brain against it for a coupple of hours and am not thinking straight anymore...
 
I'm a bit confused on if you want something like "joenumb" or "joe1" so I included solutions for both.

if you want joenumb:
evaluate(new&"numb")

if you want joe1:
evaluate(new&numb)

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1959-2001)
 
Let's see.. Here's how I'd do this..

Code:
// Create an empty "list"
// set variable
<cfset "#new#numb"=dude.recordcount">
// Append to the list
<cfset nnlist=listappend(nnlist,"#new#numb")>

And then when I'm reading the variable..

I'm not sure how you're cycling through the output, If you're calling it by name (or name in a variable) you don't need nnlist..

Code:
#evaluate(name_var_here & "numb")#

If you're cycling through by number like... the first row would get the first numb you set, the second row would get the second, then you can use..

Code:
#evaluate(listgetat(nnlist,cyclelistpos))#

For instance if this is a cfoutput, you could use currentrow for cyclelistpos.. that is if each output uses a different variable..

Code:
#evaluate(listgetat(nnlist,currentrow))#

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
thanks guys my partner pointed out that my function was working fine it was the next call I was miss calling.. thats what happens when you try and code on too little caffene
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top