Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Export to CSV and preserve formatting Post Reply Post New Topic
Author Message
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Topic: Export to CSV and preserve formatting
     Posted: 20 Mar 2014 at 9:01am

Hi,

I'm on Crystal 2008. I've created a report where I had to created text fields with static data. For example, one data field must appear as 015. this also needs to be exported to CSV. When we export to .csv, I lose the leading zero.
 
How do I preserve the formatting so it preserves the leading zero AND preserves the text field as text? Thanks!


Edited by thummel1 - 20 Mar 2014 at 9:07am
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 20 Mar 2014 at 1:08pm
Are you working with a text field or a number field?  If it is a text field, then I would think the '0' would be preserved.  If it is a number field then you have to pad it with leading zero(s) in a formula.
IP IP Logged
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Posted: 21 Mar 2014 at 2:13am

In this particular crystal report, I've added text fields and inserted numbers that have leading zeros  (e.g. 015). When exported to CSV, I lose the leading zero.

What formula do you suggest I use to save the formatting of this field? But also, for other reports where I have to pull in data fields that have leading zeros (vs creating a text field and adding static values), what would the steps be to preserve that as well?
 
I was just directed to this link that suggests my request is not possible (or at least, more steps will be required), but hoping for a 2nd opinion.
 


Edited by thummel1 - 21 Mar 2014 at 2:32am
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 24 Mar 2014 at 5:02am
Here is a formula that might work in your case.  FYI: formatting is lost when exporting to csv.

ToText({table.field},"00000000")


IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum