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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field is converting to a date format when I export to a CSV file

Status
Not open for further replies.

chaitealover

Technical User
Apr 30, 2009
6
CA
I'm using Crystal XI.

I have a field in a Crystal Report that displays correctly as: 01-02

When I export the Crystal Report to a CSV file the field is converting to a date format of mm/dd/yyyy and displays as: 2-Jan

If the field value is 22-45, then it doesn't convert to a date format. It stays as is and the cell format in the CSV file is General - which is correct.

How do I format the field in the Crystal Report so the field is exported as it appears, because its not a date field? It should appear in the CSV file as 01-02.

Thank you.
 
You could try "01 - 02" - I doubt it would convert that.

Or add some leading or trailing spaces, if it has to be NN-NN format.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Thank you but I'm unable to change the source data. This field is not a NN-NN format it's an alpha/numerica field where anything could be entered. It's only when someone enters data that can be converted to a date that I'm having a problem.

I was hoping someone could provide a formula that I could apply to the field that would format it so it wouldn't convert to a date upon exporting to a CSV FILE.
 
Hi,
Does it display 2-Jan in the raw CSV file ( viewed with a text editor, for instance) or in the application that uses it ( Like Excel or Access)?




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Here's a sample of how the data is displayed in my Crystal Report:
12-13
u17-23
12 - 3
22-24

Here's how the above data is displayed in the CSV file:
13-Dec
u17-23
3-Dec
22-24
 
I did some more testing on the data and if I replace the dash '-' with a blank the data exports to the CSV file correctly.

So now my question is, what is the formula to replace the dash with a blank? Keeping in mind the dash isn't always in the same spot in the field. Sometimes it's the 2nd, 3rd or 4th character. ie: 01-02, 01 - 02, 1-2

Thank you
 
replace({field},"-","")

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top