Okay, so I ran into an issue today in my CFC design.  The code is noted below.  Basically, I init a customer object and set some values in a website user structure.  Later, I load customer data into this info container into a customer structure.  After that, I try to load an array of addresses into the customer info container and cold fusion tells me that it cannot insert the complex array value into a simple construct.  What gives?  I build out the basic functionality listed below, this will work as is, but will not work within my cfcs:

<!--- stWebsiteUser is set in a CFC init routine and sits in session memory --->
<!--- as an info container.  There are some simple value strings set at the root of  --->
<!--- this container --->
<cfset stWebsiteUser = StructNew()>
<cfset stWebsiteUser.ID = 100>

<!--- ROUTINE: loadCustomerInfo --->
<!--- stTemp is returned by a function called getCustomerInfo --->
<cfset stTemp = StructNew()>
<cfset stTemp.key1 = "some info">
<cfset stTemp.key2 = "some info">
<cfset stTemp.key3 = "some info">
<cfset stTemp.key4 = "some info">

<!--- this line sets the stCustomer in the stWebsiteUser container with the --->
<!--- values returned by the loadCustomerInfo routine --->
<cfset StructInsert(stWebsiteUser, "stCustomer", stTemp, "true")>

<!--- ROUTINE: loadCustomerAddressInfo --->
<!--- aTemp is returned by a function called getCustomerAddressInfo --->
<cfset aTemp = ArrayNew(1)>
<cfset aTemp[1] = StructNew()>
<cfset aTemp[1].addressinfo1 = "address info">
<cfset aTemp[1].addressinfo2 = "address info">
<cfset aTemp[1].addressinfo3 = "address info">
<cfset aTemp[1].addressinfo4 = "address info">

<cfset aTemp[2] = StructNew()>
<cfset aTemp[2].addressinfo1 = "address info">
<cfset aTemp[2].addressinfo2 = "address info">
<cfset aTemp[2].addressinfo3 = "address info">
<cfset aTemp[2].addressinfo4 = "address info">

<!--- this line sets the aAddressInfo in the stWebsiteUser.stCustomer container with the --->
<!--- values returned by the loadCustomerAddressInfo routine --->
<!---^^^^^^^^^^^^^^^^^^^^
     COLD FUSION BOMBS ON THIS LINE OF CODE WITH A NON COMMPLEX SET ERROR
     ^^^^^^^^^^^^^^^^^^^^--->
<cfset StructInsert(stWebsiteUser.stCustomer, "aAddressInfo", aTemp, "true")>

<!--- dump the values --->
<cfdump var="#stWebsiteUser#">
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to