Code:
<cfset KeyArray = ArrayNew(1)>
<cfset KeyStruct = StructNew()>
<cfloop INDEX="i" from="1" to="#Attributes.cq_value_Qry.RecordCount#">
<cfset KeyInnerArray = ArrayNew(1)>
<cfloop index="j" from="1" to="#r_cq_keycolumns.RecordCount#">
<cfset KeyInnerStruct = StructNew()>
<cfset KeyInnerStruct.Name = UCase(r_cq_keycolumns.keyname[j])>
<cfset FieldName = r_cq_keycolumns.fieldname[j]>
<cfset KeyInnerStruct.Value = Evaluate("Attributes.cq_value_Qry."&"#fieldname#" & "")>
<cfset Temp = ArrayAppend(KeyInnerArray,KeyInnerStruct)>
</cfloop>
<cfset KeyStruct.KeyCount = r_cq_keycolumns.RecordCount>
<cfset KeyStruct.Keys = KeyInnerArray>
<cfset Temp = ArrayAppend(KeyArray,KeyStruct)>
</cfloop>
The above code always returns the last value(structure) for KeyArray. When
i dump KeyArray it has the right value but when i dump the whole KeyArray array outside the loop
it has the last value of the structure. Could anyone see what i am doing wrong. Any help is appreciated.
Thanks
<cfset KeyArray = ArrayNew(1)>
<cfset KeyStruct = StructNew()>
<cfloop INDEX="i" from="1" to="#Attributes.cq_value_Qry.RecordCount#">
<cfset KeyInnerArray = ArrayNew(1)>
<cfloop index="j" from="1" to="#r_cq_keycolumns.RecordCount#">
<cfset KeyInnerStruct = StructNew()>
<cfset KeyInnerStruct.Name = UCase(r_cq_keycolumns.keyname[j])>
<cfset FieldName = r_cq_keycolumns.fieldname[j]>
<cfset KeyInnerStruct.Value = Evaluate("Attributes.cq_value_Qry."&"#fieldname#" & "")>
<cfset Temp = ArrayAppend(KeyInnerArray,KeyInnerStruct)>
</cfloop>
<cfset KeyStruct.KeyCount = r_cq_keycolumns.RecordCount>
<cfset KeyStruct.Keys = KeyInnerArray>
<cfset Temp = ArrayAppend(KeyArray,KeyStruct)>
</cfloop>
The above code always returns the last value(structure) for KeyArray. When
i dump KeyArray it has the right value but when i dump the whole KeyArray array outside the loop
it has the last value of the structure. Could anyone see what i am doing wrong. Any help is appreciated.
Thanks