You mean you wanted to do something like:

<cfloop index="i" from="1" to="4">
<cfset "testStruct#i#" = structNew()>
</cfloop>

4 different structures

or

<cfset testStruct = arrayNew(1)>
<cfloop index="i" from="1" to="4">
<cfset testStruct[i] = structNew()>
</cfloop>

array of 4 structs

or

<cfset testStruct = structNew()>
<cfloop index="i" from="1" to="4">
<cfset testStruct[i] = structNew()>
</cfloop>

struct of 4 structs?

TK
  -----Original Message-----
  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]

Reply via email to