Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Help needed on a formula!! Post Reply Post New Topic
Author Message
duggie
Newbie
Newbie


Joined: 22 Mar 2011
Location: United Kingdom
Online Status: Offline
Posts: 1
Quote duggie Replybullet Topic: Help needed on a formula!!
    Posted: 22 Mar 2011 at 2:49am
Hi, I need help on splitting up a text field that contains email addresses.  Basically, I have a field which can contain one email address, or multiple email addresses, seperated by a semi colon (;).  Each listing starts with a 4 character prefix and the end of the email addresses is dictated  by a colon character (:).  For example,
 
Xls:Jmoore20@doncaster.com;kperkins20@doncaster.com;mmcgann20@doncaster.com:DON007 Monthly Cons Issue Report
 
Xls:kbrown20@doncaster.com:DON015 Doncasters Monthly Issue Report Maintenance
 
So, the first 4 characters can be ignored, as well as the text after the (:) and where each email is divided by a (;) this could be turned into a carriage return?
 
In order for me to extract all of these email addresses and put it into an excel spreadsheet for marketing purposes, I would like the report to split the addresses so that they appear as follows:
 
 
I have tried using a combination of trim, join, filter formulas but I'm just sending my head into a spin!
 
Any help would be greatly appreciated.
 
Thanks
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 22 Mar 2011 at 3:04am
Approach each step logically.

I have a field which can contain one email address, or multiple email addresses, seperated by a semi colon (;). Each listing starts with a 4 character prefix and the end of the email addresses is dictated by a colon character (:). For example,


-Each e-mail is separated by a semi-colon
-Each contains a 4 character prefix
-list of e-mails ends with a colon

Assuming it is a single text field and it will always be this format, you would do the following in order:

1. get the index of the colon, starting from index t (just after the first colon so you don't count it)
2. take the substring from 4 to the index of the colon - 1 and split on semi-colons, and assign that to a temp array variable
3. for each item in the array, append it to a temp string var and add ChrW(13) to the end of each item.

You should end up with a huge multi-line textbox with one e-mail on each line. Though after trying that, I exported to excel (data-only) and it was still one line. I then tried exporting the entire report and it showed up properly, for which I copied the contents of the box and pasted it in another spreadsheet and it worked fine.




Edited by Keikoku - 22 Mar 2011 at 3:16am
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.047 seconds.