I'm trying to create a chart which counts two seperate entries on the same database table, and then outputs the values as a pie chart. I'm a total noob when it comes to coldfusion, although I did manage to get the following to some something similar to what i'd want (see code below).
A few things though:
1) the cfsets within the cfoutput seems like a messy hack to me, is there a better way to approach getting those values from the database?
2) I would like to get the value from count, as well as the percentage comparing the two values. is this possible?
<cfquery name="MCount" datasource="reporting_db" >
SELECT Count(*) as Mer from printer_orderwhere Printer_Number_FK = 2;
<cfoutput query="MCount"> <cfset Mercount = Mer></cfoutput>
<cfquery name="DGCount" datasource="reporting_db" >
SELECT Count(*) as DG from printer_order where Printer_Number_FK = 1;
<cfoutput query="DGCount"> <cfset DCount = DG></cfoutput>
<cfchartdata item="Orders To M" value=#MerCount#>
<cfchartdata item="Orders To DG" value=#DCount#>