Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
murpg #1
Writing a comma delimted text file using CFFILE
Can someone please tell me what is the proper syntac for writing a comma
delimited text file. In the CFSET tag when I name the variable for the output
attribute of the CFFILE tag I get an error saying this is the wrong syntac.
Here is my code.
<cfquery name="Recordset1" datasource="stores">
SELECT product.ItemNumber, product.Name, product.Summary,
product.InventoryEnforce, product.InventoryLevel,
product.InventoryMinimumLevel, product.Weight, product.Units, product.ImageURL,
product.ThumbnailURL, product.VariationZ, product.Tag, product.ByLine,
product.MajorT, product.SpecificationX, product.SpecificationY,
product.Keywords, product.UPC, product.ISBN, product.Remove,
product.Price_Standard_Orders_USD, product.Sale_Price_Standard_Orders_USD,
product.Available_Standard_Orders_USD, product.On_Sale_Standard_Orders_USD,
product.Featured_Standard_Orders_USD, product.Tax_Free_Standard_Orders_USD,
product.Extra_Shipping_Standard_Orders_USD
FROM product
ORDER BY product.ItemNumber, product.Name, product.Summary,
product.InventoryEnforce, product.InventoryLevel,
product.InventoryMinimumLevel, product.Weight, product.Units, product.ImageURL,
product.ThumbnailURL, product.VariationZ, product.Tag, product.ByLine,
product.MajorT, product.SpecificationX, product.SpecificationY,
product.Keywords, product.UPC, product.ISBN, product.Remove,
product.Price_Standard_Orders_USD, product.Sale_Price_Standard_Orders_USD,
product.Available_Standard_Orders_USD, product.On_Sale_Standard_Orders_USD,
product.Featured_Standard_Orders_USD, product.Tax_Free_Standard_Orders_USD,
product.Extra_Shipping_Standard_Orders_USD
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfloop query="Recordset1">
<!---Error when it is like this--->
<cfset newProducts = ItemNumber, & "" & Name,>
<!---No Error when it is like this but there is no comma Below is the first
line of My Comma delimited Text File--->
<cfset newProducts = ItemNumber & "" & Name>
<cffile action="append" file="C:\Documents and
Settings\Administrator.WBG.000\My Documents\My
Pictures\ProductStoreImages\commaproduct.txt" output="#newProducts#">
</cfloop>
</body>
</html>
Item Number,Name,Summary,Inventory Enforce,Inventory Level,Inventory Minimum
Level,Weight,Units,Image URL,Thumbnail URL,Variation
#1,Tag,By-Line,Text,Specification #1,Specification
#2,Keywords,UPC,ISBN,Delete,Price (Standard Orders-USD),Sale Price (Standard
Orders-USD),Available (Standard Orders-USD),On Sale (Standard
Orders-USD),Featured (Standard Orders-USD),Tax Free (Standard Orders-USD),Extra
Shipping (Standard Orders-USD)
murpg Guest
-
cffile starts writing on line 2
I have a .cfm template that builds a .txt file by concatenating strings then writing it to the server using cffile as a text file. The problem is... -
Creating a text file & writing to it
I went through a bit of articles on how to retrieve variables from a .txt file from the local machine. But I want to know can we create a text file... -
Writing a Text File in Flash...
http://www.multidmedia.com/software/flashstudio/features.php is a free (for non-commercial use) app that lets you save to text files. -
Writing to a csv text file
Say I ran a query that pulled 100 records with 10 fields into a RecordSet I'll call "rsQryResult" How would I: 1. write this data to a .csv text... -
Loading delimted file into Access with ASP on the fly
Ed Kautz wrote: As Bob said: don't instantiate an Access object on the server. you can use fso/readline to get a record from the text file. ... -
The ScareCrow #2
Re: Writing a comma delimted text file using CFFILE
<cfset newProducts = ItemNumber & "," & Name>
Or
<cfset newProducts = "#ItemNumber#, #Name#">
Ken
The ScareCrow Guest
-
harshalsuri #3
Re: Writing a comma delimted text file using CFFILE
<cfquery name="Recordset1" datasource="stores">
SELECT product.ItemNumber, product.Name, product.Summary,
product.InventoryEnforce, product.InventoryLevel,
product.InventoryMinimumLevel, product.Weight, product.Units, product.ImageURL,
product.ThumbnailURL, product.VariationZ, product.Tag, product.ByLine,
product.MajorT, product.SpecificationX, product.SpecificationY,
product.Keywords, product.UPC, product.ISBN, product.Remove,
product.Price_Standard_Orders_USD, product.Sale_Price_Standard_Orders_USD,
product.Available_Standard_Orders_USD, product.On_Sale_Standard_Orders_USD,
product.Featured_Standard_Orders_USD, product.Tax_Free_Standard_Orders_USD,
product.Extra_Shipping_Standard_Orders_USD
FROM product
ORDER BY product.ItemNumber, product.Name, product.Summary,
product.InventoryEnforce, product.InventoryLevel,
product.InventoryMinimumLevel, product.Weight, product.Units, product.ImageURL,
product.ThumbnailURL, product.VariationZ, product.Tag, product.ByLine,
product.MajorT, product.SpecificationX, product.SpecificationY,
product.Keywords, product.UPC, product.ISBN, product.Remove,
product.Price_Standard_Orders_USD, product.Sale_Price_Standard_Orders_USD,
product.Available_Standard_Orders_USD, product.On_Sale_Standard_Orders_USD,
product.Featured_Standard_Orders_USD, product.Tax_Free_Standard_Orders_USD,
product.Extra_Shipping_Standard_Orders_USD
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfloop query="Recordset1">
<!---Error when it is like this--->
<cfset newProducts = ItemNumber, & "" & Name,>
<!---No Error when it is like this but there is no comma Below is the first
line of My Comma delimited Text File--->
<cfset newProducts = ItemNumber & "" & Name>
<cffile action="append" file="C:\Documents and
Settings\Administrator.WBG.000\My Documents\My
Pictures\ProductStoreImages\commaproduct.txt" output="#newProducts#">
</cfloop>
</body>
</html>
Everything is fine in the above code but <cfoutput> tag is missing because of
which you might be facing problem. Try this out
<body>
<cfoutput>
<cfloop query="Recordset1">
<!---Error when it is like
this--->
<cfset newProducts =
ItemNumber, & "" & Name,>
<!---No Error when it is like
this but there is no comma Below is the first line of My Comma delimited Text
File--->
<cfset newProducts = ItemNumber
& "" & Name>
<cffile action="append"
file="C:\Documents and Settings\Administrator.WBG.000\My Documents\My
Pictures\ProductStoreImages\commaproduct.txt" output="#newProducts#">
</cfloop>
</cfoutput>
</body>
harshalsuri Guest
-
travelinrob #4
Re: Writing a comma delimted text file using CFFILE
You do not need to use <CFOUTPUT>. Everything listed is a Coldfusion tag.
travelinrob Guest



Reply With Quote

