Crystal 2008, separating out data in a string

A time back the experts help with a report which separated data out of a string of data divided by Section character (§).  I have attached the original report plus the basic information that I need to additionally separate out. I need 2 reports reflecting different data, one for SSN changes and the other an addition to the original report for addresses and now home phone number and cell phone number.  The SSN report the position I am trying to target only begins at §-5 and ends at §-6 and is 9 characters long.  The Address and phone numbers, the additional positions is for §-26,27,28 and §68,69,70.  I thought I could do this by updating the formulas but it does not appear to be working. Can you help me?
WIP-Address-audit-SSN-Test.rpt
AUDIT-BASIC-TEST-audit.xls
WIP-Address---Phone-Numbers-audit.rpt
AUDIT-BASIC-TEST-Address---Phone-numbers
GrapeladyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James0628Commented:
If you just want to display those parts of the field on the report, it would probably be a lot easier to just create new formulas for them, rather than try to change existing formulas to also extract those parts of the fields, and somehow include them with the other things that those formulas are displaying.

 This formula displays the section of BEFORE_1 that follows the 5th delimiter (if there is a 5th delimiter):

Local StringVar Array string_pieces;

if not IsNull ({AUDT_AUDIT_TRAIL.BEFORE_1}) then
(    
  string_pieces := Split ({AUDT_AUDIT_TRAIL.BEFORE_1}, '§');
  if UBound (string_pieces) > 5 then
    string_pieces [ 6 ]
  else
    ""
)

Open in new window



 This formula displays the sections of BEFORE_1 that follow the 26th and 27th delimiters (if there are that many delimiters).  It puts a space in between the two values:

Local StringVar Array string_pieces;
Local StringVar extracted_pieces;

if not IsNull ({AUDT_AUDIT_TRAIL.BEFORE_1}) then
(    
  string_pieces := Split ({AUDT_AUDIT_TRAIL.BEFORE_1}, '§');
  if UBound (string_pieces) > 26 then
    extracted_pieces := string_pieces [ 27 ];
  if UBound (string_pieces) > 27 then
    extracted_pieces := extracted_pieces + " " + string_pieces [ 28 ];
);
extracted_pieces

Open in new window



 This formula displays the sections of BEFORE_1 that follow the 68th and 69th delimiters (if there are that many delimiters).  It puts a space in between the two values:

Local StringVar Array string_pieces;
Local StringVar extracted_pieces;

if not IsNull ({AUDT_AUDIT_TRAIL.BEFORE_1}) then
(    
  string_pieces := Split ({AUDT_AUDIT_TRAIL.BEFORE_1}, '§');
  if UBound (string_pieces) > 68 then
    extracted_pieces := string_pieces [ 69 ];
  if UBound (string_pieces) > 69 then
    extracted_pieces := extracted_pieces + " " + string_pieces [ 70 ];
);
extracted_pieces

Open in new window


 For the AFTER_1 field, just create copies of the formulas above and replace both references to BEFORE_1 in each formula with AFTER_1.

 James
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GrapeladyAuthor Commented:
Thank you James for the solutions, they worked wonderfully!
0
James0628Commented:
You're welcome.  Glad I could help.

 James
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.