Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Trim Field Post Reply Post New Topic
Author Message
btamulis
Newbie
Newbie
Avatar

Joined: 02 Aug 2008
Online Status: Offline
Posts: 9
Quote btamulis Replybullet Topic: Trim Field
    Posted: 15 Jun 2010 at 4:17am
I think this is fairly simple in Crystal -
 
My report has an item number (string field) that is always 15 characters long.
 
Example - 10.10.131.22500
 
On my report I want to truncate the first 3 characters (always).
 
Example - 10.131.22500
 
Any guidance would be appreciated........
 
Thanks in advance.......... 
Thanks to all who contribute to this forum!!!
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 15 Jun 2010 at 4:20am
You can use the right function to return the right most characters (12?).  Example: Right({String}, 12).  If you ever have a string that is not a fixed length, then you can use len to determine the lenght of the string first.  Example:  right({String}, len({String}) - 3).

Edited by kevlray - 15 Jun 2010 at 4:21am
IP IP Logged
btamulis
Newbie
Newbie
Avatar

Joined: 02 Aug 2008
Online Status: Offline
Posts: 9
Quote btamulis Replybullet Posted: 15 Jun 2010 at 5:16am
Worked like a champ!Clap
 
Thanks.........
Thanks to all who contribute to this forum!!!
IP IP Logged
nsk74n
Newbie
Newbie


Joined: 08 Dec 2009
Online Status: Offline
Posts: 11
Quote nsk74n Replybullet Posted: 10 Feb 2015 at 10:34am
I tried doing this and I get an error stating a string is required and last I checked it is a field name and I have that. Am missing something else?

Right({DriveMaster.DriveID},4)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Feb 2015 at 11:03am
Likely it is a numeric field.
what are the some sample values and how do you want them displayed?
IP IP Logged
nsk74n
Newbie
Newbie


Joined: 08 Dec 2009
Online Status: Offline
Posts: 11
Quote nsk74n Replybullet Posted: 10 Feb 2015 at 11:14am
It is. Got past that. Now I need to get rid of the comma.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 10 Feb 2015 at 12:04pm
If it is a numeric field, then it is just a formatting option (look at your tool bar).  If it is a string, then try replace.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Feb 2015 at 4:07am
if for some reason you chose to convert it to text you can format it during the conversion but as Kevlray indicates there are easy formatting options while keeping it numeric.
 
totext(number_field, x ,"")
the X is the number of decimal places you want
the "" indicates not to use the anything (e.g. a comma) as a seperator
 
or you can apply formatting with lead zero like this
totext(number_field,"00000.00")
 
quite a few options in the format process that are well explained in Crystal Help
 


Edited by DBlank - 11 Feb 2015 at 7:55am
IP IP Logged
nsk74n
Newbie
Newbie


Joined: 08 Dec 2009
Online Status: Offline
Posts: 11
Quote nsk74n Replybullet Posted: 11 Feb 2015 at 4:31am
Thanks. I will try that.
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.016 seconds.