Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using split where there are variable numbers Post Reply Post New Topic
Author Message
rob.morris
Newbie
Newbie


Joined: 09 Oct 2014
Online Status: Offline
Posts: 3
Quote rob.morris Replybullet Topic: Using split where there are variable numbers
     Posted: 25 Jun 2015 at 4:35am
Hi
I'm having trouble creating a formula that will split a field value after a number.
 
The database holds information on refuse collection day and the content of the field to be split is always in the format
 
"Domestic Round X Y Week Z"
 
where X is a number from 1-6
Y is a day of the week from Monday-Friday
Z is either "1" or "2"
 
eg
Domestic Round 1 Friday Week 2
Domestic Round 5 Monday Week 1
 
I want to split the field after the number so that in the two examples above it would return
"Friday Week 2"
"Monday Week 1".
 
I can split it based on a set number eg after "Domestic Round 1" using the formula below
stringVar array Size := Split({PPV_ROUTE.ROUTENAME},"1 ");
if UBound(Size)>=2 then
Size[2] else "";
 
but how would i set it up to say split after any number?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jun 2015 at 6:09am

Since the first part is a standard length you can simplify this with a mid()

mid({PPV_ROUTE.ROUTENAME},18)
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