Passing XML data to variable
I am currently working on a project which requires XML data. I would like to retrieve the dynamic data from sql server using logged in user parameters (depending on the user logged in, the data would differ). I was able to create a query from either ColdFusion or SQL server internally which resembles the data structure required for the chart, but I cannot figure how to attach the result string from the query to the chart.
Here is my query:
<cfquery name="rsXML" datasource="MyDataBase">
SELECT tag, Parent, [pie!1!slice],[slice!2!title],[slice!2!pull_out],[slice!2!!id]
FROM dbo.tblIssuesDataForXML
WHERE CompanyID = var1 and DivisionID = var2
FOR XML EXPLICIT
</cfquery>
This returns the following result:
<pie><slice title="Group1" pull_out="false">5</slice><slice title="Group2" pull_out="false">19</slice><slice title="Group3" pull_out="false">3</slice><slice title="Group4" pull_out="true">93</slice></pie>
on a table as follows:
| Record | XML_F52E2B61-18A1-11D1-B105-00805F49916B |
|---|---|
| 1 | <pie><slice title="Group1" pull_out="false">5</slice><slice title="Group2" pull_out="false">19</slice><slice title="Group3" pull_out="false">3</slice><slice title="Group4" pull_out="true">93</slice></pie> |
From this point I am not sure how to attach the information correctly to the chart. I need to pass the XML data as follows:
so.addVariable("chart_data", encodeURIComponent("<<< YOUR CF GENERATED XML GOES HERE >>>"));With numerous attempts I have not been succesful and as you can see I am rather inexperienced in this. I have received a message saying:
Complex cannot be converted into simple variable
I would appreciate any help or insight given here.
I am currently using ColdFusion 8, Dreamweaver CS3 and SQL Server 2008.
