To index a ColdFusion query:
Create a ColdFusion page with the following content:
1
<html>
<head>
<title>Adding Query Data to an Index</title>
</head>
<body>
<!--- retrieve data from the table --->
<cfquery name="getEmps" datasource="CompanyInfo">
SELECT * FROM EMPLOYEE
</cfquery>
<!--- update the collection with the above query results --->
<cfindex
query="getEmps"
collection="CodeColl"
action="Update"
type="Custom"
key="Emp_ID"
title="Emp_ID"
body="Emp_ID,FirstName,LastName,Salary">
<h2>Indexing Complete</h2>
<!--- output the record set --->
<p>Your collection now includes the following items:</p>
<cfoutput query="getEmps">
<p>#Emp_ID# #FirstName# #LastName# #Salary#</p>
</cfoutput>
</body>
</html>
Save the file as collection_db_index.cfm in the myapps directory under the web root directory.
2
Open the file in the web browser to index the collection.
3
Working with record sets
527
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers