Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Pulling Data in a String Post Reply Post New Topic
Author Message
Ricci
Newbie
Newbie
Avatar

Joined: 09 Jul 2012
Location: United States
Online Status: Offline
Posts: 8
Quote Ricci Replybullet Topic: Pulling Data in a String
     Posted: 22 Jan 2013 at 5:02am
I am trying to pull two groups of data from a string. The problem is sometimes the number of characters change (but never the format). I need to pull the colored fields below into two seperate variables. Can anyone point me in the right direction?
 
EX: 1234-1-DN-E-AB-10-001


Edited by Ricci - 22 Jan 2013 at 5:03am
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 22 Jan 2013 at 5:57am
I have not used the split function before, so it took a couple of minutes of trial and error.  I think this will work.

stringvar origstr := "1234-1-DN-E-AB-10-001";
shared stringvar firststr;
shared stringvar secondstr;
firststr := split(origstr,"-")[3];
secondstr := split(origstr,"-")[4]

Of course you would replace the origstr with the field you would be splitting.
IP IP Logged
Ricci
Newbie
Newbie
Avatar

Joined: 09 Jul 2012
Location: United States
Online Status: Offline
Posts: 8
Quote Ricci Replybullet Posted: 22 Jan 2013 at 6:01am
Awesome! It worked!!!!!!! Thank you so much.

Edited by Ricci - 22 Jan 2013 at 6:08am
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