Hi there -
I don't know if you ever figured out what to do, but I
thought I would add my 2 cents so that it may help you or someone
else.
The Short and sweet answer to using Arrays in CFCHART is to
turn them into Queries.
I will provide my code and some comments to explain what I am
doing and why. I won't explain the tags, that's up to you.
I hope this helps!
<!--- This will create a Query without a datasource and
can be accessed normally in a CFOUTPUT tag if you wanted. --->
<cfset bp_query = QueryNew("bp, bp_cnt, total", "varchar,
varchar, decimal")>
<!--- This next section creates a simple counter, and the
loop goes through my array to exclude any array row that has a $0
total. I do this so that the CFCHART looks cleaner in the
presentation. But that's only because I need to do that. You may
not want to. --->
<cfset bp_row_cnt = 0>
<cfloop from="1" to="6" index="i">
<cfif bodyparts
[2] GT 0>
<cfset bp_row_cnt = bp_row_cnt + 1>
</cfif>
</cfloop>
<!--- This next command adds the number of rows to the
query. It adds the number of rows that it counted above --->
<cfset temp = QueryAddRow(bp_query, bp_row_cnt)>
<!--- This next section does the following: It sets a
counter (zz). This will be used to assign my array row into the
proper Query Row. Some may be saying, why not use the Index in the
loop(below) to keep track. Simply put, you may have 9 rows in the
array and your query will only need to display 7 of 9. If you try
and put Array row 9 into the Query, it will blow up.
Anyway, the following code takes each part of the arrya and
inserts it into the query into the proper row and column--->
<cfset zz=1>
<cfloop from="1" to="6" index="i">
<cfif bodyparts[2] GT 0>
<cfset temp = QuerySetCell(bp_query,"bp",bodyparts
[1],zz)>
<cfset temp =
QuerySetCell(bp_query,"bp_cnt",bodyparts[2],zz)>
<cfset temp =
QuerySetCell(bp_query,"total",numberformat(bodyparts
[3],"0.00"),zz)>
<cfset zz=zz+1>
</cfif>
</cfloop>
Any questions, please let me know.
Thanks,
Doug