Why get the record element of the undefined error element?

I have a request

SELECT csedept_name,submitterdept, COUNT(execoffice_status) as 'starsgiven'
FROM   Depts d 
       LEFT JOIN CSEReduxResponses c on d.csedept_id = c.submitterdept
                                    .......
                                    and YEAR ([approveddate]) =2014
                                    and month ([approveddate]) =12
                                    ....

      

and when i run into microsolf sql server studio i get 20 rows returned and all with 'submitterdept' null. but i keep getting this error:

Element RECORDCOUNT is undefined in GETBRANCHSTARS.

The error occurred in stars.cfm: line 498

496 : </cfif>
497 : <cfset totalbranch =0 >
498 : <cfif getbranchstars.recordcount gt 0>
499 : 
500 :   <h1> Counts </h1

      

For some reason, recordcount is not recognized.

What am I doing wrong?

<cfset totalbranch =0 >

<cfif getbranchstars.recordcount gt 0>  
    <table >
        <thead><tr><th>Branch</th><th>Stars Given</th></tr></thead>
        <tbody>
        <cfoutput query="getbranchstars" >
        <tr>
        <td>#CSEDEPT_NAME#</td>
        <td>#BRANCHTOTALSTARSGIVEN#</td>
        </tr>
        <cfset totalbranch += BRANCHTOTALSTARSGIVEN>
        </cfoutput>
        </tbody>

     <tfoot>
        <cfoutput>
        <tr>
        <th>&nbsp;</th>
        <th><div align="left">#totalbranch#</div></th>
        </tr>
        </cfoutput>
    </tfoot>

    </table>

<cfelse>
<p>No Branch Department Counts</p>
</cfif>

      

+3


source to share


2 answers


I got this error when running a routine that toggles the session parameter in the onRequest app, which affected the conditional logic as to whether the request should be fired or not. When the session setup is restricted to execute a request, later code is run based on this parameter with session coverage to output data if RECORDCOUNT. After subsequent calls to the same page without switching, the page works fine. So apparently CF was somehow getting a new session setup in time to start the request, but didn't have time to start all the homework to attach the recordCount to the request object. I took out the session condition to execute the request and I no longer get the missing RECORDCOUNT error.



0


source


I also got this error. In my case I solved the problem by adding the result to the cfquery, result="result_name"

. Then changed query_name.recordcount

to result_name.recordcount

.



-1


source







All Articles