User Guide

56 Chapter 4 Retrieving and Formatting Data
<cfif form.lastname is not "">
AND Employee.LastName = #Form.LastName#
</cfif>
</cfquery>
<cfif GetEmployees.recordcount is "0">
No records match your search criteria. <br>
Please go back to the form and try again.
<cfelse>
<h4>Employee Data Based on Criteria from Form</h4>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Salary</th>
</tr>
<cfoutput query="GetEmployees">
<tr>
<td>#FirstName#</td>
<td>#LastName#</td>
<td>#Salary#</td>
</tr>
</cfoutput>
</cfif>
</table>
</body>
</html>
3 Save the file.
4 Return to the form, enter search criteria and submit the form.
5 If no records match the criteria you specified, the message displays.
Returning results incrementally
You can use the cfflush tag to incrementally output long-running requests to the
browser before a ColdFusion page is fully processed. This allows you to give the user
quick feedback when it takes a long time to complete processing a request. For
example, you can use
cfflush to display the message, Processing your request --
please wait. when a request takes time to return. You can also use it to
incrementally display a long list as it gets retrieved.
The first time you use the
cfflush tag on a page, it sends to the browser all of the
HTML headers and any other available HTML. Subsequent
cfflush tags on the page
send only the output that ColdFusion generated since the previous flush.
You can specify an interval attribute to tell ColdFusion to flush the output each
time that at least the specified number of bytes become available. (The count does
not include HTML headers and any data that is already available when you make this
call.) You can use the
cfflush tag in a cfloop to incrementally flush data as it
becomes available. This format is particularly useful when a query responds slowly
with large amounts of data.