Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Forumla help to split data Post Reply Post New Topic
Author Message
stephen.field
Newbie
Newbie


Joined: 18 Jun 2012
Online Status: Offline
Posts: 2
Quote stephen.field Replybullet Topic: Forumla help to split data
    Posted: 18 Jun 2012 at 1:46pm
Hi
I am trying to figure out how to get a block of data split by a space. The data in the report looks like below and we want to change it so there is a space between countyr code and the numbers ie US5922337A would be US 5922337A.
 
I used this formula Left ({@Add CR},2 ) + " " + Right({@Add CR},length({@Add CR})-2) but the problem I have is that the data is in one big block so therefore that formula only works on the first line and ignores the rest.
 
Any ideas?
 
Thank you
 
US5922337A
AT174755T
AT208560T
AU199062043A
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 19 Jun 2012 at 2:56am
since it is really a string of values like xx99\nxx98\n, I would try looping through the data parsing on the chrw(13) + chrw(10) characters...
 
probably even easier would be to SPLIT the field into an array based on those characters, modify each array element then JOIN them back into a string.
 
Hope this points in a direction that works for you.
IP IP Logged
stephen.field
Newbie
Newbie


Joined: 18 Jun 2012
Online Status: Offline
Posts: 2
Quote stephen.field Replybullet Posted: 19 Jun 2012 at 11:59am
Thanks for your reply. I'm not that good at formulas but I tried some things around splitting into an array but then I can't figure out how to make the array then split based on the first 2 characters after the line break.
Do you know?
Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 20 Jun 2012 at 7:11am
since the first 2 values are not unique, for the entire array--unlike the delimiter, the better functions to use are left and (mid or right) like you were doing to update each array.  Once all the members are updated, then you can probably JOIN them back together and the report will continue as doing before.
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.