When I open the csv file with notepad, indeed, the format is right in
notepad as I want.
So, the task is how to write the data in text format.   I am
generating the file through <cfoutput query ...>.
Please advise.

thx much

On Thu, Apr 10, 2008 at 3:18 PM, Kris Jones <[EMAIL PROTECTED]> wrote:
> You want this data to format as text, not numeric. Excel will
>  automatically format what it thinks are numerics without any leading
>  zeros. Check the file in notepad or some other straight-up text
>  editor. When saving a csv file from Excel, make sure you format the
>  columns as text prior to saving (and always keep an original file in
>  excel format).
>
>  Cheers,
>  Kris
>
>
>
>  >  I have a query returning employee, jobcode:
>  >
>  >  <cfquery name="GetHR" datasource="MyHRDB">
>  >  select employee, jobcode
>  >  from hrdb
>  >  </cfquery>
>  >
>  >  The query returns:
>  >
>  >  023598    1332
>  >  028977    2908
>  >  032409    0180
>  >  037325    3350
>  >  042242    6220
>  >  048140    3121
>  >  051482    0430
>  >  056176    3110
>  >  ......
>  >
>  >  <cfset expandpath = "D:\HR\">
>  >  <cfset HEADER= "employee,jobcode"
>  >  <cffile action="Write" file="#expandpath("HRData.csv")#"
>  >  output="#HEADER#" addnewline="Yes">
>  >
>  >  <cfoutput query="GetHR">
>  >  <cfset CONTENT="#employee#, #jobcode#>
>  >
>  >  <cffile action="APPEND"  file="#expandpath("HRData.csv")#"
>  >  addnewline="Yes" output="#CONTENT#">
>  >  </cfoutput>
>  >
>  >  However, the .csv file shows the data wihout leading zero(s) like below:
>  >
>  >  23598    1332
>  >  28977    2908
>  >  32409    180
>  >  37325    3350
>  >  42242    6220
>  >  48140    3121
>  >  51482    430
>  >  56176    3110
>  >
>  >  I tried NumberFormat with:
>  >
>  >  <cfset CONTENT="#NumberFormat(employee, "000000")#,
>  >  #NumberFormat(jobcode,"0000")#>
>  >
>  >  but, the result still shows data without leading zero(s).
>  >  How do you put leading zero(s) on the .csv file?
>  >
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:303132
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to