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>
> >
> >
> 
> 

______________________________________________________________________
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

Reply via email to