Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Parsing/Extract part of a String? Post Reply Post New Topic
Author Message
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Topic: Parsing/Extract part of a String?
    Posted: 12 Sep 2017 at 9:52am
I am needing to extract part of a string. An example of the content of the string in my field is listed below. The field name is Command.Description.

RED BLOOD CELLS|CPD>AS1/500mL/refg|Irradiated|ResLeu:<5log6

I need to extract what comes after the first"|" and before the first "/" character. In this case i want the result of my formula to equal "CPD>AS1"

Note that the number of characters and spaces preceding the first "|" is variable and that the number of characters and spaces proceeding the first "/" is variable. Also the number of characters in between is variable.

I have never tried doing this before with crystal, therefore i don't really even know where to begin.

My ultimate goal is to determine the number of characters between the first"|" and the first"/".

Thanks in advance for any help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2017 at 10:07am
mid({Command.Description},instr({Command.Description},"|")+1,instr({Command.Description},"/")-instr({Command.Description},"|")-1)
IP IP Logged
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Posted: 12 Sep 2017 at 10:27am
thanks. worked great
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.