Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Is there a formula to extract only part of a field Post Reply Post New Topic
Author Message
althomas
Newbie
Newbie


Joined: 09 Nov 2010
Online Status: Offline
Posts: 36
Quote althomas Replybullet Topic: Is there a formula to extract only part of a field
    Posted: 13 Jun 2012 at 10:12am
Hi,
  I was wondering if there is formula in crystal reports to extract part of a field. Our database has a bill of material with dots for indentation next to the part numbers. i want to get rid of the dots.
 
Current Status:
Level 1 =  .2502650
level 2 =   ..2652560
Level 3 =  ...3505401
Level 4 =  ....5544641
 
What i want is to only extract the part numbers:
2502650
2652560
3505401
5544641
 I want a formula to get rid of the (...) in front of the part numbers. The part numbers could be any digit long. they are not all 7 digits long, so i cant really use the (left, right) function.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jun 2012 at 11:33am
probably more elegant solutions out there but here is one
 
right({table.field},len({table.field})-instrrev({table.field},'.'))
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 13 Jun 2012 at 9:31pm
A simpler solution would be;
 
replace({table.field},".","")
 
Regards,
Ryan.
IP IP Logged
althomas
Newbie
Newbie


Joined: 09 Nov 2010
Online Status: Offline
Posts: 36
Quote althomas Replybullet Posted: 14 Jun 2012 at 2:19am
Thank you so much!!!! the "replace" function worked perfectly....
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jun 2012 at 3:41am
Thanks for simplifying it Ryan. I did not use the replace as I incorrectly assumed that there was other descriptive text before the decimal point that also needed ot be removed.
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.