Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Converting Truncated Number to String 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: Converting Truncated Number to String Issue
    Posted: 10 Apr 2009 at 8:39am
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.


Edited by CRG2009 - 13 Apr 2009 at 5:51pm
CRG2009
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Apr 2009 at 6:43am
You could try converting to text first then trimming the decimals and finally adding the 'C'.  something like:
 
totext({auto_key}, 0, "") + 'C'
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.