Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Extract all data after an underscore from the righ Post Reply Post New Topic
Author Message
stevbren
Newbie
Newbie
Avatar

Joined: 20 Nov 2007
Online Status: Offline
Posts: 33
Quote stevbren Replybullet Topic: Extract all data after an underscore from the righ
     Posted: 08 Oct 2013 at 5:40am
I'm stuck. I have spent hours searching and trying various things I have found online.
I have a string that is variable in length with many underscores in the name. Many people name these different. The one common theme is everything after the final underscore identifies the location. That is what I want to extract and group from.
 
Example of text could be "shdgbdfs_nmdhueb_nkdhfjend_ABC"
I want the ABC only.
 
Thank you in advance,
 
Steve
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 08 Oct 2013 at 9:42am
its something like this
right( "shdgbdfs_nmdhueb_nkdhfjend_ABC",length("shdgbdfs_nmdhueb_nkdhfjend_ABC")- InStrrev ("shdgbdfs_nmdhueb_nkdhfjend_ABC", "_",-1,1))
IP IP Logged
stevbren
Newbie
Newbie
Avatar

Joined: 20 Nov 2007
Online Status: Offline
Posts: 33
Quote stevbren Replybullet Posted: 08 Oct 2013 at 9:48am
Thank you for the reply. This will return "ABC" only won't it?
 
The strings can be any data and the last 3 characters can be;
Actual choices:
SMH
MMC
DMC
MMI
HBV
and more. These represent specific business locations.
IP IP Logged
stevbren
Newbie
Newbie
Avatar

Joined: 20 Nov 2007
Online Status: Offline
Posts: 33
Quote stevbren Replybullet Posted: 08 Oct 2013 at 9:56am
NEVERMIND, I am a moron. This report is stressing me out so much. If I put the field (duh) in it works.
THANK YOU SO MUCH
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