User Guide
50 Chapter 4 Retrieving and Formatting Data
</body>
</html>
3 Save the page as actionpage.cfm within the myapps directory.
4 View formpage.cfm in your browser.
5 Enter Smith in the Last Name text box and submit the form.
6 The records that match the criteria specified in the form appear in a table.
Reviewing the code
The following table describes the highlighted code and its function:
Formatting individual data items
You might want to format individual data items. For example, you can format the
Salary field as a monetary value.
To format the Salary using the dollar format, you use the CFML expression
DollarFormat(number).
To change the format of the Salary:
1 Open the file actionpage.cfm in ColdFusion Studio.
2 Change the line
<td>#Salary#</td>
to
<td>#DollarFormat(Salary)#</td>
Code Description
<table>
Put data into a table.
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Salary</th>
</tr>
In the first row of the table, include three
columns, with the headings: First Name, Last
Name, and Salary.
<cfoutput query="GetEmployees">
Get ready to display the results of the
GetEmployees query.
<tr>
<td>#FirstName#</td>
<td>#LastName#</td>
<td>#Salary#</td>
</tr>
Create a new row in the table, with three
columns. For a record, put the value of the
FirstName field, the value of the LastName field,
and the value of the Salary field.
</cfoutput>
Keep getting records that matches the criteria,
and display each row in a new table row until you
run out of records.
</table>
End of table.