Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

How to show cfelse condition inside a loop?

$
0
0

I have this code:

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

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?

 

thanks


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>