Ok, I'm sorta new to working with arrays, but the code I'm using is:
<!--- This will count all fencing ratings and assign them to an array --->
<cfset classList=arraynew(2)>
<cfset classListLoop="A,B,C,D,E,U">
<cfset bigLoopCount=0>
<cfif (#url.f# eq 1) and (#url.e# eq 1)>
<cfset bigLoopCount=2>
<cfelse>
<cfset bigLoopCount=1>
</cfif>
<cfset classLoopCount=1>
<cfloop from="1" to="#bigLoopCount#" index="j">
<cfloop list="#classListLoop#" delimiters="," index="i">
<cfset classList[#j#][#classLoopCount#][1]=#i#>
<!--- send to udf to count each rating occurance and assign to
variable --->
<cfinvoke component="components.ov_rating"
method="rating" returnvariable="result">
<cfinvokeargument name="tid"
value="#url.tid#">
<cfinvokeargument name="dbfield" value="e_foil_rating">
<cfinvokeargument name="rating" value="#i#">
</cfinvoke>
<cfset classList[#j#][#classLoopCount#][2]=#result#>
<cfset classLoopCount=classLoopCount+1>
</cfloop>
</cfloop>
What I'm getting for the <cfdump> of the array classList, if bigLoopCount=2, is:
Array 1
Array 1 Struct 1 A
2 0
Array 2 Struct 1 B
2 0
Array 3 Struct 1 C
2 0
Array 4 Struct 1 D
2 1
Array 5 Struct 1 E
2 2
Array 6 Struct 1 U
2 0
Array 2
Array 1 [undefined array element]
Array 2 [undefined array element]
Array 3 [undefined array element]
Array 4 [undefined array element]
Array 5 [undefined array element]
Array 6 [undefined array element]
Array 7 Struct 1 A
2 0
Array 8 Struct 1 B
2 0
Array 9 Struct 1 C
2 0
Array 10 Struct 1 D
2 1
Array 11 Struct 1 E
2 2
Array 12 Struct 1 U
2 0
Why am I getting the [undefined array element]??? And it almost seems like the
2nd array is looping twice......where did I go wrong????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314090
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4