or
variables.["testStruct#i#"]= structNew();
or
variables.testStruct[i]= structNew();
will do it, depending on what exactly you're trying to do. I think you want
one of the first two (which do the same thing). I prefer the second, as
it's more readable, IMO.
cheers,
barneyb
-----Original Message-----
From: Sandy Clark [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2003 10:58 AM
To: CF-Talk
Subject: RE: I need some enlightenment...
<cfscript>
for (i=1; i LTE 4; i = i+1) {
variables.testStruct#i#= structNew();
}
</cfscript>
_____
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2003 1:54 PM
To: CF-Talk
Subject: I need some enlightenment...
I still consider myself to be somewhat inexperienced when it comes to
creating/using complex data types, so please forgive my ignorance.
In the following bit of code:
<cfscript>
for (i=1; i LTE 4; i = i+1) {
variables.testStruct[i] = structNew();
}
</cfscript>
<cfdump var="#variables#" />
I expected it to create four separate structures within the variables
scope/structure, i.e. variables.testStruct1, variables.testStruct2,
variables.testStruct3, variables.testStruct4
instead it creates a structure of structures, i.e. variables.testStruct.1,
variables.testStruct.2, variables.testStruct.3, variables.testStruct.4
Can someone please explain to me what I am missing?
Thanks,
Nate
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

