Search code examples
coldfusioncfchartqoq

This is weird issue I am geting while doing Query of Query


Here is the scenario, I am getting the result-set from the following code and i am running the following below query after getting the result from cfdump, but it shows empty second dump, do not why?

can anyone check what is wrong:

<cfif StructKeyExists(URL,'submitsearch') AND URL.submitsearch neq ''>
  <cfset answers = initial.getSearchResults('#URL#')>
  <cfset flag = 'yes'>
</cfif>

<cfchart format="png" scalefrom="0" scaleto="#answers.recordcount#" show3d="Yes">
    <cfchartseries type="bar" serieslabel="Support Tickets" seriescolor="##009933">
    <cfdump var="#answers#">
    <cfoutput query="answers">
        <cfquery dbtype="query" name="myString">
            SELECT count(*) as strvalue 
            FROM answers 
            WHERE status = "#trim(answers.status)#"
        </cfquery>
    <cfchartdata item="#Status#" value="#myString.strvalue#">
    </cfoutput>
    <cfdump var="#myString#">
   </cfchartseries>
   </cfchart>

This is howing an issue, it does not anything: do not know why:

<cfdump var="#myString#">

Edit

Screenshot below

enter image description here


Solution

  • Based on the screenshot provided, the following is suggested

    <cfif StructKeyExists(URL,'submitsearch') AND URL.submitsearch neq ''>
      <cfset answers = initial.getSearchResults(URL)>
      <cfset flag = 'yes'>
    </cfif>
    
    
    <cfquery dbtype="query" name="qrySummary">
        SELECT status, count(status) as strvalue 
        FROM   answers 
        GROUP BY status
        ORDER BY status
    </cfquery>
    
    <cfdump var="#qrySummary#">
    
    
    <cfchart format="png" scalefrom="0" scaleto="#answers.recordcount#" show3d="Yes">
      <cfchartseries type="bar" serieslabel="Support Tickets" seriescolor="##009933">
      <cfoutput query="qrySummary">
          <cfchartdata item="#Status#" value="#strvalue#">
      </cfoutput>
      </cfchartseries>
    </cfchart>
    

    Also see

    Query of query support for aggregate functions

    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0e4fd-7ff0.html#WSc3ff6d0ea77859461172e0811cbec0e4fd-7fcc