You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Leading Zeros Issue in CSV/Excel formatterd reports

1 reply [Last post]
shiv4uall's picture
User offline. Last seen 10 years 40 weeks ago. Offline
Joined: 11/18/2008
Posts: 8

If you use APP ENGINE to report the data from the temp table /staging table on to CSV file using excel format, there is a known issue with fields that have leading zeros. For ex:You have a field of length 6 characters. If the field value is 002123, the excel file removes the leading zeros. But if the requirement is to preserve those leading zeros, we can do something like this.
Update the temp table right before you write out into a file.

Update %Table(Temp_Stg) A
Set A.Field = (Select '"='||A1.Field||'"' from %Table(Temp_Stg) A1 where A1.Keyfield = A.Keyfield)
Where A.Process_Instance = A1.Process_Instance

Basically , excel file can retain the leading zeros if the field is of the following format : "=Field"


Lepa's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Leading Zeros Issue in CSV/Excel formatterd reports

Welcome to the site Shiva!
Why don't you post this as a "Code sample" post? That way it will show on your blog at

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog