Dynamic variable Name in cfif
I'm having no trouble setting and outputting a dynamic variable name: cfoutputExpires_#UpdateMe#= #form[ 'Expires_' UpdateMe]#/cfoutput but when I go to evaluate that variable: cfif form[ 'Expires_' UpdateMe ] EQ Yes it returns: Variable YES is undefined because the VALUE of the Variable named Expires7 is indeed YES. I know there's a simple fix to this, but can't remember how. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358899 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dynamic variable Name in cfif
I'm having no trouble setting and outputting a dynamic variable name: cfoutputExpires_#UpdateMe#= #form[ 'Expires_' UpdateMe]#/cfoutput but when I go to evaluate that variable: cfif form[ 'Expires_' UpdateMe ] EQ Yes it returns: Variable YES is undefined because the VALUE of the Variable named Expires7 is indeed YES. Without quotes around Yes, CF sees it as a variable name, not a literal string. Dave Watts, CTO, Fig Leaf Software 1-202-527-9569 http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358902 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dynamic variable Name in cfif
Also, shouldn't it be cfif form[ 'Expires_' UpdateMe ] is 'Yes' ??? or is it the current trend to use EQ when checking a text field nowadays? :) On Fri, Jul 18, 2014 at 6:22 AM, Dave Watts dwa...@figleaf.com wrote: I'm having no trouble setting and outputting a dynamic variable name: cfoutputExpires_#UpdateMe#= #form[ 'Expires_' UpdateMe]#/cfoutput but when I go to evaluate that variable: cfif form[ 'Expires_' UpdateMe ] EQ Yes it returns: Variable YES is undefined because the VALUE of the Variable named Expires7 is indeed YES. Without quotes around Yes, CF sees it as a variable name, not a literal string. Dave Watts, CTO, Fig Leaf Software 1-202-527-9569 http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358912 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dynamic variable Name in cfif
Also, shouldn't it be cfif form[ 'Expires_' UpdateMe ] is 'Yes' ??? or is it the current trend to use EQ when checking a text field nowadays? :) They're equivalent, so it doesn't matter which one you use. It's purely a matter of personal preference. Dave Watts, CTO, Fig Leaf Software 1-202-527-9569 http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358913 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Dynamic variable name (WAS: XML Variable Issue)
OK, well while on the subject of doing things the correct way, how would you set this value? cfset config.siteConfig.siteSections.#url.SectionName#.XMLText = True works, but is there a better/cleaner way? Yey, cfif IsDefined(Config.SiteConfig.SiteSections.#Sections.Name#) works fine! cfif structKeyExists(config.siteConfig.siteSections,sections.name) Faster, safer. Do a Google search for isDefined and CGI scope to see why structKeyExists is better. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190888 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
You could do cfset config.siteConfig.siteSections[url.SectionName].XMLText = True -Original Message- From: James Smith [mailto:[EMAIL PROTECTED] Sent: 18 January 2005 10:59 To: CF-Talk Subject: RE: Dynamic variable name (WAS: XML Variable Issue) OK, well while on the subject of doing things the correct way, how would you set this value? cfset config.siteConfig.siteSections.#url.SectionName#.XMLText = True works, but is there a better/cleaner way? Yey, cfif IsDefined(Config.SiteConfig.SiteSections.#Sections.Name#) works fine! cfif structKeyExists(config.siteConfig.siteSections,sections.name) Faster, safer. Do a Google search for isDefined and CGI scope to see why structKeyExists is better. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190889 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Dynamic variable name (WAS: XML Variable Issue)
When dealing with structures (or XML since most of the time XML objects can be dealt with like you deal with structures) a good rule of thumb is to us the . (request.page_id) when you know what you are looking for and to use the [] (request[something]) when you are using a variable to evaluate what you are looking for, so in request[something] something would be a vadiable containing page_id. Hope that helps. Adam H On Tue, 18 Jan 2005 09:58:52 -, James Smith [EMAIL PROTECTED] wrote: OK, well while on the subject of doing things the correct way, how would you set this value? cfset config.siteConfig.siteSections.#url.SectionName#.XMLText = True works, but is there a better/cleaner way? Yey, cfif IsDefined(Config.SiteConfig.SiteSections.#Sections.Name#) works fine! cfif structKeyExists(config.siteConfig.siteSections,sections.name) Faster, safer. Do a Google search for isDefined and CGI scope to see why structKeyExists is better. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190903 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Dynamic variable name (WAS: XML Variable Issue)
A related issue (at a completely diferent point in the code)... If the SectionName is dynamic, how would you access the variable? For example the Variable name Config.SiteConfig.SiteSections.UserManager.XmlText has the UserManager part in another variable called Sections.Name. I have tried many options and variations with no success and I know this is easy as I have done it before (although not from XML) and I can't remember how! EG: cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. Sections.Name)) -- Jay If you are using it like that you need to .XmlText on the end to get the XmlText part of the XmlNode. Config.SiteConfig.SiteSections.UserManager.XmlText And as it is text and not a boolean value I think you will need to use: cfif Config.SiteConfig.SiteSections.UserManager.XmlText IS TRUE Andrew. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190759 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning ...-Original Message- ...From: James Smith [mailto:[EMAIL PROTECTED] ...Sent: Monday, January 17, 2005 8:56 AM ...To: CF-Talk ...Subject: Dynamic variable name (WAS: XML Variable Issue) ... ...A related issue (at a completely diferent point in the code)... ... ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ... If you are using it like that you need to .XmlText on the end ... to get the XmlText part of the XmlNode. ... ... Config.SiteConfig.SiteSections.UserManager.XmlText ... ... And as it is text and not a boolean value I think you will ... need to use: ... ... cfif Config.SiteConfig.SiteSections.UserManager.XmlText IS TRUE ... ... Andrew. ... ... ... ... ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190763 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
Unfortunately... cfif parameterExists(Config.SiteConfig.SiteSections[Sections.Name]) Throws an error (Invalid CFML construct found on line 13 at column 83.) -- Jay Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190767 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Dynamic variable name (WAS: XML Variable Issue)
useless_rant ok unless you sare on some oooddd version why would you be using this functionparameterExists /useless_rant Adam H On Mon, 17 Jan 2005 17:08:03 -, James Smith [EMAIL PROTECTED] wrote: Unfortunately... cfif parameterExists(Config.SiteConfig.SiteSections[Sections.Name]) Throws an error (Invalid CFML construct found on line 13 at column 83.) -- Jay Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190772 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
Although cfoutput#Config.SiteConfig.SiteSections[Sections.Name]#/cfoutput works fine! HELP! How can one error and the other work! I don't get it! -- Jay -Original Message- From: James Smith [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:08 To: CF-Talk Subject: RE: Dynamic variable name (WAS: XML Variable Issue) Unfortunately... cfif parameterExists(Config.SiteConfig.SiteSections[Sections.Name]) Throws an error (Invalid CFML construct found on line 13 at column 83.) -- Jay Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190776 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
Sorry, what is wrong with parameterExists()? Has it been depreciated without me knowing? -- Jay -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:17 To: CF-Talk Subject: Re: Dynamic variable name (WAS: XML Variable Issue) useless_rant ok unless you sare on some oooddd version why would you be using this functionparameterExists /useless_rant Adam H On Mon, 17 Jan 2005 17:08:03 -, James Smith [EMAIL PROTECTED] wrote: Unfortunately... cfif parameterExists(Config.SiteConfig.SiteSections[Sections.Name]) Throws an error (Invalid CFML construct found on line 13 at column 83.) -- Jay Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190777 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
What do you know, apparently is has, teach me to browse the docs from time to time eh! -- Jay -Original Message- From: James Smith [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:21 To: CF-Talk Subject: RE: Dynamic variable name (WAS: XML Variable Issue) Sorry, what is wrong with parameterExists()? Has it been depreciated without me knowing? -- Jay -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:17 To: CF-Talk Subject: Re: Dynamic variable name (WAS: XML Variable Issue) useless_rant ok unless you sare on some oooddd version why would you be using this functionparameterExists /useless_rant Adam H On Mon, 17 Jan 2005 17:08:03 -, James Smith [EMAIL PROTECTED] wrote: Unfortunately... cfif parameterExists(Config.SiteConfig.SiteSections[Sections.Name]) Throws an error (Invalid CFML construct found on line 13 at column 83.) -- Jay Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190778 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Dynamic variable name (WAS: XML Variable Issue)
Yey, cfif IsDefined(Config.SiteConfig.SiteSections.#Sections.Name#) works fine! -- Jay -Original Message- From: James Smith [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:24 To: CF-Talk Subject: RE: Dynamic variable name (WAS: XML Variable Issue) What do you know, apparently is has, teach me to browse the docs from time to time eh! -- Jay -Original Message- From: James Smith [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:21 To: CF-Talk Subject: RE: Dynamic variable name (WAS: XML Variable Issue) Sorry, what is wrong with parameterExists()? Has it been depreciated without me knowing? -- Jay -Original Message- From: Adam Haskell [mailto:[EMAIL PROTECTED] Sent: 17 January 2005 17:17 To: CF-Talk Subject: Re: Dynamic variable name (WAS: XML Variable Issue) useless_rant ok unless you sare on some oooddd version why would you be using this functionparameterExists /useless_rant Adam H On Mon, 17 Jan 2005 17:08:03 -, James Smith [EMAIL PROTECTED] wrote: Unfortunately... cfif parameterExists(Config.SiteConfig.SiteSections[Sections.Name]) Throws an error (Invalid CFML construct found on line 13 at column 83.) -- Jay Bracket [] notation. Config.SiteConfig.SiteSections[Sections.Name] ...If the SectionName is dynamic, how would you access the variable? ... ...For example the Variable name ...Config.SiteConfig.SiteSections.UserManager.XmlText has the ...UserManager ...part in another variable called Sections.Name. I have tried many ...options ...and variations with no success and I know this is easy as I have done it ...before (although not from XML) and I can't remember how! ... ...EG: ...cfif parameterExists(Config.SiteConfig.SiteSections.#Sections.Name#) ...cfif parameterExists(evaluate(Config.SiteConfig.SiteSections. ...Sections.Name)) ... ...-- ...Jay ... ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190780 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Dynamic variable name (WAS: XML Variable Issue)
On Mon, 17 Jan 2005 17:26:45 -, James Smith [EMAIL PROTECTED] wrote: Yey, cfif IsDefined(Config.SiteConfig.SiteSections.#Sections.Name#) works fine! cfif structKeyExists(config.siteConfig.siteSections,sections.name) Faster, safer. Do a Google search for isDefined and CGI scope to see why structKeyExists is better. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190782 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Dynamic variable name (WAS: XML Variable Issue)
Yes sorry guess I shoulda been a little more explicite in what to do instead of parameterexists instead of just ranting heh Adam H On Mon, 17 Jan 2005 09:36:41 -0800, Sean Corfield [EMAIL PROTECTED] wrote: On Mon, 17 Jan 2005 17:26:45 -, James Smith [EMAIL PROTECTED] wrote: Yey, cfif IsDefined(Config.SiteConfig.SiteSections.#Sections.Name#) works fine! cfif structKeyExists(config.siteConfig.siteSections,sections.name) Faster, safer. Do a Google search for isDefined and CGI scope to see why structKeyExists is better. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190797 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
dynamic variable name
My brain is fried. How do I do this? cfloop from=1 to=10 index=i cfset dynamicName_#i# = #i# /cfloop So that I end up with variables name dynamicName_1 through dynamicName_10? Shawn McKee __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: dynamic variable name
cfset dynamicName_#i# = i Or cfset SetVariable(dynamicName_#i#, i) Or Use an array for dynamicName and use the dynamicName[] notation if i is a number. Or Use a struct for dynamicName and use the dynamicName[] notation if I can be any string. If you can do the 3rd option, go for the 3rd option. :) James Ang Senior Programmer MedSeek, Inc. [EMAIL PROTECTED] -Original Message- From: Shawn McKee [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 3:59 PM To: CF-Talk Subject: dynamic variable name My brain is fried. How do I do this? cfloop from=1 to=10 index=i cfset dynamicName_#i# = #i# /cfloop So that I end up with variables name dynamicName_1 through dynamicName_10? Shawn McKee __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: dynamic variable name
cfset dynamicName_#i# = i - Original Message - From: Shawn McKee [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, June 15, 2002 10:59 AM Subject: dynamic variable name My brain is fried. How do I do this? cfloop from=1 to=10 index=i cfset dynamicName_#i# = #i# /cfloop So that I end up with variables name dynamicName_1 through dynamicName_10? Shawn McKee __ 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 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: dynamic variable name
cfset dynamicName_#i# = #i# On Fri, 14 Jun 2002, Shawn McKee wrote: My brain is fried. How do I do this? cfloop from=1 to=10 index=i cfset dynamicName_#i# = #i# /cfloop So that I end up with variables name dynamicName_1 through dynamicName_10? Shawn McKee __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: dynamic variable name
Doh! Thanks -Original Message- From: James Ang [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 6:04 PM To: CF-Talk Subject: RE: dynamic variable name cfset dynamicName_#i# = i Or cfset SetVariable(dynamicName_#i#, i) Or Use an array for dynamicName and use the dynamicName[] notation if i is a number. Or Use a struct for dynamicName and use the dynamicName[] notation if I can be any string. If you can do the 3rd option, go for the 3rd option. :) James Ang Senior Programmer MedSeek, Inc. [EMAIL PROTECTED] -Original Message- From: Shawn McKee [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 3:59 PM To: CF-Talk Subject: dynamic variable name My brain is fried. How do I do this? cfloop from=1 to=10 index=i cfset dynamicName_#i# = #i# /cfloop So that I end up with variables name dynamicName_1 through dynamicName_10? Shawn McKee __ 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 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: dynamic variable name
I think you want to use SetVariable(name , value). You could also use evaluate(), but I think it would be more of a pain. Just a word of advice, so please don't take it the wrong way, but you should be very careful of using evaluate() or setvariable(). There is almost always a simpler, faster way to do what you want. (I think it's been two or more years since I've needed to use either.) Twice five syllables, Plus seven, can't say much, but ... That's haiku for you. Jeff Polaski Manager, Web Services Research Graduate Studies University California, Irvine -Original Message- From: Shawn McKee [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 3:59 PM To: CF-Talk Subject: dynamic variable name My brain is fried. How do I do this? cfloop from=1 to=10 index=i cfset dynamicName_#i# = #i# /cfloop So that I end up with variables name dynamicName_1 through dynamicName_10? Shawn McKee __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists