Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

numberformat not working

Status
Not open for further replies.

gatetec

MIS
Mar 22, 2007
420
US
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?

thx much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top