Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Leading Zeros in Crystal Post Reply Post New Topic
Author Message
Crystal Learner
Newbie
Newbie


Joined: 12 Jul 2011
Online Status: Offline
Posts: 7
Quote Crystal Learner Replybullet Topic: Leading Zeros in Crystal
     Posted: 12 Jul 2011 at 11:59am
Hi,
 
Could you please suggest how I could get rid of the leeding zeros in crystal reports. I have a object by name Product ID which has a value of 0000000000000000000000000000000000900017 for which I would like the output to be 900017, I tried some of the options like Right ({ZCT_GENRE_V.PRODUCT_ID}, 5), Val(str) etc. and it dint work for me.
 
Thanks in Advance
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 12 Jul 2011 at 12:59pm
Try adding  Split  to the beginning of your formula.
IP IP Logged
Crystal Learner
Newbie
Newbie


Joined: 12 Jul 2011
Online Status: Offline
Posts: 7
Quote Crystal Learner Replybullet Posted: 12 Jul 2011 at 1:12pm
Hello,
 
Thank you for your reply...can you please be more specific as I am new to Crystal.
 
 
IP IP Logged
Crystal Learner
Newbie
Newbie


Joined: 12 Jul 2011
Online Status: Offline
Posts: 7
Quote Crystal Learner Replybullet Posted: 14 Jul 2011 at 8:06am
Any Suggestions Please...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jul 2011 at 8:52am
just convert it to a number field type and format that to look the way you want
tonumber({ZCT_GENRE_V.PRODUCT_ID})
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jul 2011 at 8:54am
or if you want it to remain a string do a double conversion to a mnumeric which removes the lead zero and then back to text
 
totext(tonumber({ZCT_GENRE_V.PRODUCT_ID}),0,"")
IP IP Logged
Crystal Learner
Newbie
Newbie


Joined: 12 Jul 2011
Online Status: Offline
Posts: 7
Quote Crystal Learner Replybullet Posted: 18 Jul 2011 at 8:48am
Thank you for your answers. It worked.
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