1 Reply Latest reply on Aug 4, 2009 1:01 PM by ilssac

    Passing XML data  to  variable

    hevi98

      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:

       


      RecordXML_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.

        • 1. Re: Passing XML data  to  variable
          ilssac Level 5

          What is the name of this variable?

          RecordXML_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>

           

           

           

          What is the line of code the generated this error?

          Complex cannot be converted into simple variable

           

           

          Properly combine the variable with the function call and all should be good.