Chapter 15: Interacting with Remote Servers
235
•
When duplicate column heading names are encountered, ColdFusion adds an
underscore character to the duplicate column name to make it unique. For
example, if two CustomerID columns are found, the second is renamed
"CustomerID_".
To create a query from a text file:
1.
Create a new file in Studio.
2.
Modify the file so that it appears as follows:
<!--- The text file consists of six columns --->
<!--- separated by commas. --->
<!--- The rows are --->
<!--- OrderID,OrderNum,OrderDate --->
<!--- ShipDate,ShipName,ShipAddress --->
<!--- This example accepts the first row --->
<!--- of the text file as the column names --->
<CFHTTP METHOD="Get"
URL="http://127.0.0.1/orders/june/orders.txt"
NAME="juneorders"
DELIMITER=","
TEXTQUALIFIER="""">
<CFOUTPUT QUERY="juneorders">
OrderID: #OrderID#<BR>
Order Number: #OrderNum#<BR>
Order Date: #OrderDate#<BR>
</CFOUTPUT>
<!--- You can substitute different column names --->
<!--- by using the COLUMNS attribute --->
<CFHTTP METHOD="Get"
URL="http://127.0.0.1/orders/june/orders.txt"
NAME="juneorders"
COLUMNS="ID, Number,Date"
DELIMITER=","
TEXTQUALIFIER="""">
<CFOUTPUT QUERY="juneorders">
Order ID: #ID#<BR>
Order Number: #Number#<BR>
Order Date: #Date#<BR>
</CFOUTPUT>
3.
Substitue the URL with the location of your text file.
4.
Substitue the name of a text file and the column headers to those in your text file.
5.
Save the file as
querytextfile.cfm
in
myapps
under your Web root directory and
view it in your browser.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...