I am trying to create a series of structures.
The name of each is contained in a list, and I want to concatenate the word
"session." with the name to create a structure that resides in the SESSION
scope. I have session variables enabled and verified its works with a
regular CFSET for a session variable.
Here is the code that sets the variable:
<cfscript>
masterList = "sessionData,accountData,modifiedAccountData";
sessionData = "ID,IP,startTime,endTime,browser";
accountData = "firstName,lastName,address1,address2,city,state,zip,phone";
</cfscript>
Here's the code that sets the struct names. Loop through MASTERLIST in the
outerloop, then loop over the current index in the inner loop, setting the
items in the list as keys in the struct:
<cfset Loopvar = 1>
<cfloop list=#masterList# index="idx">
<cfset var1 = idx>
<cfset session.var1 = StructNew()>
<cfloop list=#Evaluate(ListGetAt(Masterlist, LoopVar))# index="idx2">
<cfset foo = StructInsert(session.var1, idx2, "", 1)>
</cfloop>
<cfset LoopVar = LoopVar + 1>
</cfloop>
----------------
The inner loop seems to work just fine, adding the keys to the struct.
Can anyone offer a solution to successfully dynamically create the
structure as a session variable with the name equal to the index of the
outer loop?
Thanks!
Alex Sherwood
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]