Dynamic variable construction and it's use
Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
Re: Dynamic variable construction and it's use
#evaluate(countvar)# - Original Message - From: "Kevin Gilchrist" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Thursday, January 25, 2001 12:41 PM Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
You don't use the # signs within the cfset tag. Aside from that though, yes, you do just say cfoutput#countvar#/cfoutput . In your set statement you assigned the return value of the code on the right to the variable on the left. -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 10:42 AM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
#Evaluate(session.application_view_list[i].name "_red")# would ouptut the value. So would #evaluate(countvar)# Rick -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 12:42 PM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
You can do this by wrapping an evaluate function around it... you might need to play with # and " placement though. I don't have time to test right now... good luck! cfoutput #evaluate(session.application_view_list[i].name_red)# /cfoutput -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 1:42 PM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
Re: Dynamic variable construction and it's use
#evaluate(countvar)# jon - Original Message - From: "Kevin Gilchrist" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Thursday, January 25, 2001 1:41 PM Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
Evaluate("#countvar#") -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 10:42 AM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
-Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 12:42 To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Try using: cfoutput #Evaluate("#countvar#")# /cfoutput I use this all of the time with good success. Let me know if you have any problems with this. Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
when u dynamically name variables, it's always best to keep consistent with variable names. I usually append number increments to the end of dyn. vars -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 12:42 PM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
Kevin, Put it inside the function Evaluate(#oracledb_red#). -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 10:42 AM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
Re: Dynamic variable construction and it's use
actually if its within quotes then yes you do. and to answer the question if you want countvar to equal the value of your dynamic variable then its: cfset countvar=evaluate(session.application_view_list[i].name "_red" Fred - Original Message - From: "Tim Fields" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Thursday, January 25, 2001 6:14 PM Subject: RE: Dynamic variable construction and it's use You don't use the # signs within the cfset tag. Aside from that though, yes, you do just say cfoutput#countvar#/cfoutput . In your set statement you assigned the return value of the code on the right to the variable on the left. -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 10:42 AM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use
Actually if you look at the set statement he does need the #'s. He wouldn't need them if it was contstructed like this. cfset countvar= session.application_view_list[i].name "_red" The way that he has it written, with the var inside of "'s he does need the #'s. As far as getting the value of the var within a var he needs to use evaluate(). #Evaluate(countvar)# --K -Original Message- From: Tim Fields [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 11:15 PM To: CF-Talk Subject: RE: Dynamic variable construction and it's use You don't use the # signs within the cfset tag. Aside from that though, yes, you do just say cfoutput#countvar#/cfoutput . In your set statement you assigned the return value of the code on the right to the variable on the left. -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 10:42 AM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
RE: Dynamic variable construction and it's use - summary
Thanks people, that worked a treat. The variable itself was a session variable so what I ended up with was cfoutput #evaluate("session." session.application_view_list[i].name "_red")# /cfoutput I decided to just drop the intermediate countvar step... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 2:18 PM To: CF-Talk Subject: RE: Dynamic variable construction and it's use #Evaluate(session.application_view_list[i].name "_red")# would ouptut the value. So would #evaluate(countvar)# Rick -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 12:42 PM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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
Re: Dynamic variable construction and it's use
Make that Evaluate(#countvar#) :) Todd Ashworth - Original Message - From: "PEREZ, RICHARD RINGO (SBCSI)" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Thursday, January 25, 2001 3:59 PM Subject: RE: Dynamic variable construction and it's use | Kevin, | | Put it inside the function Evaluate(#oracledb_red#). | | -Original Message- | From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] | Sent: Thursday, January 25, 2001 10:42 AM | To: CF-Talk | Subject: Dynamic variable construction and it's use | | | Hi there, | | If construct a variable name dynamically like; | | cfset countvar="#session.application_view_list[i].name#_red" | | How do I then output the contents of the newly constructed variable? | | If the code above evaluated to a variable name e.g. "oracledb_red", how | would I do the equivalent of | cfoutput | #oracledb_red# | /cfoutput | | Doing | | cfoutput | #countvar# | /cfoutput | | will obviously just output the new variable name but not it's contents. | I've tried various permutations of #'s and quotes but can't seem to get it | right. | Is there a way to do this? | | Thanks, | Kevin ~~ 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
RE: Dynamic variable construction and it's use
Katrina, Yeah, I should have actually read that message before responding! :-) I totally missed that he was looking for the *value* of the variable. I'm glad the right answer quickly followed, and in abundance! Thanks. -Original Message- From: Katrina Chapman [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 8:32 AM To: CF-Talk Subject: RE: Dynamic variable construction and it's use Actually if you look at the set statement he does need the #'s. He wouldn't need them if it was contstructed like this. cfset countvar= session.application_view_list[i].name "_red" The way that he has it written, with the var inside of "'s he does need the #'s. As far as getting the value of the var within a var he needs to use evaluate(). #Evaluate(countvar)# --K -Original Message- From: Tim Fields [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 11:15 PM To: CF-Talk Subject: RE: Dynamic variable construction and it's use You don't use the # signs within the cfset tag. Aside from that though, yes, you do just say cfoutput#countvar#/cfoutput . In your set statement you assigned the return value of the code on the right to the variable on the left. -Original Message- From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 10:42 AM To: CF-Talk Subject: Dynamic variable construction and it's use Hi there, If construct a variable name dynamically like; cfset countvar="#session.application_view_list[i].name#_red" How do I then output the contents of the newly constructed variable? If the code above evaluated to a variable name e.g. "oracledb_red", how would I do the equivalent of cfoutput #oracledb_red# /cfoutput Doing cfoutput #countvar# /cfoutput will obviously just output the new variable name but not it's contents. I've tried various permutations of #'s and quotes but can't seem to get it right. Is there a way to do this? Thanks, Kevin ~~ 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