How about this one?  I think it'll work on CF5, and certainly on CFMX.  

<cfloop query="qTopItems">
    <cfset application["Array_#qTopItems.ID#"] = ArrayNew(1)>
</cfloop>

You could also use structInsert/structUpdate, if you wanted

Cheers,
barneyb

> -----Original Message-----
> From: David Robinson [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 26, 2004 2:36 PM
> To: CF-Talk
> Subject: Naming application-scoped variables from within a loop
>
> The following code works fine to create a set of arrays:
> Array_1, Array_2,
> etc.
>
> <cfloop query="qTopItems">
>     <cfset ChildArray = "Array_" & #qTopItems.ID#>
>     <cfset ChildArray = ArrayNew(1)>
> </cfloop>
>
> But I can't figure out how to create that group of arrays as
> application-scoped objects.
> How would I go about creating objects so that I end up with
> application.Array_1, application.Array_2, etc. ?
>
> I have tried:
>
> <cfloop query="qTopItems">
>     <cfset ChildArray = "application.Array_" & #qTopItems.ID#>
>     <cfset ChildArray = ArrayNew(1)>
> </cfloop>
>
> which creates arrays, but not in the application scope. The
> <cfapplication>
> tag is working fine - I have other application variables - my
> problem is
> with using some variable in building the name of an
> application variable.  I
> must be missing something, probably something pretty obvious.
>  Any help
> would be greatly appreciated.
>
> Dave
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to