Print Page | Close Window

Forumla help to split data

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16784
Printed Date: 16 Apr 2025 at 7:15pm


Topic: Forumla help to split data
Posted By: stephen.field
Subject: Forumla help to split data
Date 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 ( mailto:%7b@Add - {@Add CR},2 ) + " " + Right( mailto:%7b@Add - {@Add CR},length( mailto:%7b@Add - {@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



Replies:
Posted By: lockwelle
Date 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.


Posted By: stephen.field
Date 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


Posted By: lockwelle
Date 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.



Print Page | Close Window