1 Reply Latest reply on May 23, 2014 4:52 AM by BKBK

    How to show cfelse condition inside a loop?


      I have this code:

      <table cellpadding="0" cellspacing="0" class="tablecolors">
      <h2>Stars Counts</h2>
        <cfloop query="GetEmployeeTotals3">
           <cfif GetEmployeeTotals3.csedept_id eq aFieldValue> 
        <tr><td>#GetEmployeeTotals3.emp_namefirst# #GetEmployeeTotals3.emp_namelast#</td><td>#GetEmployeeTotals3.employeetotal#</td></tr>
      <p>no results.</p>

      Here the query will show the cfelse and the results in the query.

      I just cant seem to figure out how i can get it if there are no results in the getemployeetotals3 to not display the table and show 'no results'.

      I have try putting in a counter but for some reason it doesn't work and gives me weird results.

      Maybe im putting it in the wrong place.

      i cant put the cfloop on top because that will just make it loop over and over again.

      any ideas on how i can make it work if there are not record in the query?