Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Grouping by "%@domain.%" Post Reply Post New Topic
Author Message
hancorn
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Online Status: Offline
Posts: 9
Quote hancorn Replybullet Topic: Grouping by "%@domain.%"
     Posted: 03 Nov 2009 at 6:32am
Hi everyone,

Wonder if you could point me in the right direction for the following query:

I have a list of records that I would like to group by.
The records all have email addresses associated to them e.g j.smith@companyA.com

I would to group by the domain name of the email address.

Is there a way that you can tell Crystal to only look at a certain portion of the email address and then group by that?

Any help would be greatly appreciated.

Thanks
Sean




Edited by hancorn - 03 Nov 2009 at 6:48am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Nov 2009 at 7:36am
use a formula to strip it out and then group on that formula. I am sure there is a more elegant code to do this but this should function
Place it on the detail to validate it is getting the full domain name before grouping...
 


Edited by DBlank - 03 Nov 2009 at 7:37am
IP IP Logged
hancorn
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Online Status: Offline
Posts: 9
Quote hancorn Replybullet Posted: 05 Nov 2009 at 3:58am
Thank you for the reply, you are most kind!

Can I then ask, what happens if some of the "table.email" values are not in a format of name@company.com. I also cannot change the non email address format values to a proper email format, unfortnuately.

I have found that it errors my report and produces no results.

"String length is less then 0 or not an integer"

Any ideas?

Thanks dblank




Edited by hancorn - 05 Nov 2009 at 3:59am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Nov 2009 at 7:16am
The answer depends on what you want to do with these data rows that are invalid.
You can just include the if-then options into the formula to handle it.
What are the variations in the errant data and how do you want to handle each type of entry error?
IP IP Logged
hancorn
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Online Status: Offline
Posts: 9
Quote hancorn Replybullet Posted: 05 Nov 2009 at 9:08am
again, cheers for your reply.

So what I would like to accomplish is the following.

Total number of requests by submitter(company or employee of that company) over a date range, grouped by submitter.

The problem I am having is that sometimes the record is recorded against the COMPANY name and sometimes the record is recorded against an employee at that company in the form of NAME@COMPANY.COM.

I need to report on all calls from a COMPANY over a time period.

So a short answer would be:

I would like to group the invalid rows(the ones that are in a format of COMPANY) to the same records that are in an EMAIL format. Obviously only when they are both from the same company.

Hope this makes sense and I have not bored you too death!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Nov 2009 at 9:24am

Messy data Confused

try this:
 
 
assuming you want to make a company name closer to the email company name for your grouping you can try the below which should force both to all uppercase and strip any spaces out of a company name to try and match the email comapny name
(e.g. jdillan@fatherandsons.com becomes "FATHERANDSONS" and "Father and Sons" also becomes "FATHERANDSONS"):
 
if instr({table.email},'@')>0 then uppercase(mid({table.email},instr({table.email},'@')+1,instrrev({table.email},'.')-instr({table.email},'@')-1)) else uppercase(replace({table.email}," ",""))
 
 


Edited by DBlank - 05 Nov 2009 at 9:25am
IP IP Logged
hancorn
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Online Status: Offline
Posts: 9
Quote hancorn Replybullet Posted: 06 Nov 2009 at 4:35am
That has worked just GREAT!

A million thanks from a very appreciative person.
IP IP Logged
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