Question
Deleting a structure from an array
I have an application where the use can step through a form
to create a list of software. To make it easier reference the
software name, ID and a few other fields are stored as a structure
in each element of a one dimensional array like this:
<cfset sDetails = StructNew()>
<cfset sDetails.LicenceDetail_ID="">
<cfset sDetails.SoftwareID="#FORM.softwareID#">
<cfset sDetails.SoftwareName="#FORM.softwareName#">
<cfset ArrayAppend(SESSION.SoftwareArray, sDetails)>
My question is, how do I properly release this information from memory when I'm done with it? If it was a regular structure stored as a Session variable I would just delete it using this code.
<cfloop index="ListElement" list="#StructKeyList(SESSION.currentSoftware)#" delimiters=",">
<cfset StructDelete(SESSION.currentSoftware, "#ListElement#")>
</cfloop>
<cfset StructDelete(SESSION, "currentSoftware")>
I tried looping through the array, then referencing the the structure element using the code above but it always throws an error saying I can convert the reference to a number. Do I even have to worry about the deleting the structures or just delete the session array?
<cfset sDetails = StructNew()>
<cfset sDetails.LicenceDetail_ID="">
<cfset sDetails.SoftwareID="#FORM.softwareID#">
<cfset sDetails.SoftwareName="#FORM.softwareName#">
<cfset ArrayAppend(SESSION.SoftwareArray, sDetails)>
My question is, how do I properly release this information from memory when I'm done with it? If it was a regular structure stored as a Session variable I would just delete it using this code.
<cfloop index="ListElement" list="#StructKeyList(SESSION.currentSoftware)#" delimiters=",">
<cfset StructDelete(SESSION.currentSoftware, "#ListElement#")>
</cfloop>
<cfset StructDelete(SESSION, "currentSoftware")>
I tried looping through the array, then referencing the the structure element using the code above but it always throws an error saying I can convert the reference to a number. Do I even have to worry about the deleting the structures or just delete the session array?
