FYI, no need for the evaluate. Change:
> <cfset bar = evaluate("application." & theVar)>
> <cfif isArray(bar)>
to
<cfif isArray(Application[theVar])>
=======================================================================
Raymond Camden, ColdFusion Jedi Master for Hire
Email : [EMAIL PROTECTED]
Yahoo IM : cfjedimaster
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Bryan Love [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 7:23 PM
> To: CF-Talk
> Subject: RE: dynamically naming arrays
>
>
> Actually they both work.
>
> Run this for proof:
>
> ------------------------------------
> <cfset theVar = "foo">
> <cflock scope="APPLICATION" type="EXCLUSIVE" timeout="5">
> <cfset "application.#theVar#" = arrayNew(1)>
>
> <cfset bar = evaluate("application." & theVar)>
> <cfif isArray(bar)>
> hooray!
> </cfif>
> </cflock>
> <cfabort>
> -------------------------------------
>
> +-----------------------------------------------+
> Bryan Love
> Macromedia Certified Professional
> Internet Application Developer
> Database Analyst
> TeleCommunication Systems
> [EMAIL PROTECTED]
> +-----------------------------------------------+
>
> "...'If there must be trouble, let it be in my day, that my
> child may have
> peace'..."
> - Thomas Paine, The American Crisis
>
>
>
> -----Original Message-----
> From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 3:10 PM
> To: CF-Talk
> Subject: RE: dynamically naming arrays
>
>
> This unfortunately turned the array into a string. Ray's idea worked
> flawlessly. Thanks anyways.
>
> -----Original Message-----
> From: Bryan Love [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 4:14 PM
> To: CF-Talk
> Subject: RE: dynamically naming arrays
>
>
> or alternatively
>
> <cfset "Application.#dynamicName#" = arrayNew(1)>
>
> +-----------------------------------------------+
> Bryan Love
> Macromedia Certified Professional
> Internet Application Developer
> Database Analyst
> TeleCommunication Systems
> [EMAIL PROTECTED]
> +-----------------------------------------------+
>
> "...'If there must be trouble, let it be in my day, that my
> child may have
> peace'..."
> - Thomas Paine, The American Crisis
>
>
>
> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 1:00 PM
> To: CF-Talk
> Subject: RE: dynamically naming arrays
>
>
> Well, since Application is a structure itself, you can easily do:
>
> <cfset Application[dynamicName] = arrayNew(1)>
>
> Don't forget your cflock of course.
>
> ==============================================================
> =========
> Raymond Camden, ColdFusion Jedi Master for Hire
>
> Email : [EMAIL PROTECTED]
> Yahoo IM : cfjedimaster
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 05, 2002 3:46 PM
> > To: CF-Talk
> > Subject: RE: dynamically naming arrays
> >
> >
> > Yes, I could. I went off into the wrong direction on this
> one from the
> > start. Is there a way to do it with the arrays so I don't
> > have to write the
> > thing over again?
> >
> > -----Original Message-----
> > From: Raymond Camden [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 05, 2002 3:39 PM
> > To: CF-Talk
> > Subject: RE: dynamically naming arrays
> >
> >
> > Why not just use structures? If Application.Chat was a
> structure, you
> > could easily add dynamic values to it by using bracket notation.
> >
> > ==============================================================
> > =========
> > Raymond Camden, ColdFusion Jedi Master for Hire
> >
> > Email : [EMAIL PROTECTED]
> > Yahoo IM : cfjedimaster
> >
> > "My ally is the Force, and a powerful ally it is." - Yoda
> >
> > > -----Original Message-----
> > > From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, September 05, 2002 3:26 PM
> > > To: CF-Talk
> > > Subject: dynamically naming arrays
> > >
> > >
> > > In the following code I am trying to make the
> application.users and
> > > application.chat arrays dynamically named.
> > >
> > > I have a variable called variables.currentroomid which I
> > > would like to be
> > > appended to the application.chat and application.users arrays
> > > like this
> > > application.chatX where x is the variables.currentroomid variable.
> > >
> > > How can I do this?
> > >
> > > <CFLOCK TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"
> > > SCOPE="SESSION">
> > > <CFIF ISDEFINED('SESSION.CHATUSERNAME')>
> > > <CFSET ENTERROOM = "">
> > > <CFELSE>
> > > <CFSET ENTERROOM = "ENTERS ROOM">
> > > </CFIF>
> > > </CFLOCK>
> > > <CFPARAM NAME="FORM.CHAT" DEFAULT="#VARIABLES.ENTERROOM#">
> > > <CFLOCK TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"
> > > SCOPE="APPLICATION">
> > > <CFIF NOT ISDEFINED('APPLICATION.USERS')>
> > > <CFSET APPLICATION.USERS=ARRAYNEW(1)>
> > > </CFIF>
> > > </CFLOCK>
> > > <CFLOCK TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"
> > > SCOPE="APPLICATION">
> > > <CFIF NOT ISDEFINED('SESSION.CHATUSERNAME')>
> > > <CFSET
> > > SESSION.CHATUSERNAME=UCASE(TRIM(GETMEMBERNAME.USERNAME))>
> > > <CFSET
> > > ARRAYAPPEND(APPLICATION.USERS,SESSION.CHATUSERNAME)>
> > > </CFIF>
> > > </CFLOCK>
> > > <CFLOCK TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"
> > > SCOPE="APPLICATION">
> > > <CFIF NOT ISDEFINED('APPLICATION.CHAT')>
> > > <CFSET APPLICATION.CHAT=ARRAYNEW(1)>
> > > <CFSET ARRAYAPPEND(APPLICATION.CHAT,'')>
> > > </CFIF>
> > > </CFLOCK>
> > > <CFLOCK TIMEOUT="10" THROWONTIMEOUT="No" TYPE="READONLY"
> > > SCOPE="APPLICATION">
> > > <CFSET
> > > ARRAYAPPEND(APPLICATION.CHAT,"<B>"&SESSION.CHATUSERNAME&" :</B>
> > > "&FORM.CHAT)>
> > > </CFLOCK>
> > >
> > >
> >
> >
>
>
>
>
______________________________________________________________________
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists