Print Page | Close Window

Help parsing an E-mail address

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
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=9914
Printed Date: 04 May 2025 at 11:18pm


Topic: Help parsing an E-mail address
Posted By: icheckout
Subject: Help parsing an E-mail address
Date Posted: 05 May 2010 at 9:36am

Thank you for looking at my post.

I am using Crystal 8 and have the following issue:

I have the e-mail address stored as one field.  I need to break it down to be 4 fields (User Name, @, Domain Name, Domain Name Extension)  for a report. Here is an example:

If the e-mail is:

jill@gmail.com

I need to break it apart to the following 4 fields:

Jill      @       gmail       com

I have tried using STRINGVAR but have not been successful with the 4 formulas.

Could someone show me the 4 formulas to break up the e-mail address?

Thank you,

Richard Scott




Replies:
Posted By: lockwelle
Date Posted: 06 May 2010 at 3:26am
why 4?  Here is what I would do:
 
local numbervar index := instr({table.field}, "@");
local numbervar dot :=instr(index, {table.field}, ".");
shared stringvar front:=left({table.field}, index-1);
shared stringvar at:=mid({table.field}, 1);
shared stringvar domain:=mid({table.field}, index+1, dot-index);
shared stringvar type :=mid({table.field}, dot+1);
 
 
now you just create the 'access' formulas, which look like:
shared stringvar domain
 
the 'tough' question is where to do this and where is it displayed?  If it is to be displayed in the same section, say detail, I would create a second detail section, move it above the main section and place the first formula in it and suppress the section, then use the display formulas in the main detail section.
 
HTH


Posted By: icheckout
Date Posted: 17 May 2010 at 10:12am
Lockwelle,
 
Thank you so much for sending me the code.  I really appreciate it.  You saved me a great deal of time.
 
-Richard Scott



Print Page | Close Window