Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Truncate issue Post Reply Post New Topic
Author Message
CRG2009
Newbie
Newbie
Avatar

Joined: 25 Mar 2009
Location: United States
Online Status: Offline
Posts: 3
Quote CRG2009 Replybullet Topic: Truncate issue
     Posted: 13 Apr 2009 at 5:53pm
I am having trouble with the formatting of 2 fields I would like to join.  First I am truncating an AUTO_KEY in a number format to remove the decimals using the following formula: truncate ({AUTO_KEY}) Everything works great and my number shows up as "12345"
 
I then want to convert the formula to a string using the following formula: cstr (truncate ({AUTO_KEY})) Everything works great and my string shows up as "12345".
 
I now want to add a "C" at the end of this string using the following formula: (cstr (truncate ({AUTO_KEY})) + 'C') Everything works great and my new string shows up as "12345C".
 
In Crystal 2008 the formatting is exactly how I want to see it.  When I open this report with another program such as Logicty Viewer, the truncating feature does not work and my field shows the decimal places again as "12345.00C".
 
I want to eventually convert this to a barcode and I can't have the decimal places.
 
I believe the problem is when the truncated AUTO_KEY is converted to a string.  Any ideas for a fix would be greatly appreciated.
CRG2009
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Apr 2009 at 7:44pm
Try
Totext(table.field,0,"") + "C"

Edited by DBlank - 13 Apr 2009 at 7:46pm
IP IP Logged
CRG2009
Newbie
Newbie
Avatar

Joined: 25 Mar 2009
Location: United States
Online Status: Offline
Posts: 3
Quote CRG2009 Replybullet Posted: 15 Apr 2009 at 6:53am
Thank you, that worked great.
CRG2009
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