Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group by on email address

Status
Not open for further replies.

ppetronas40

Programmer
Nov 10, 2008
3
US
Hi,
I am very new to Crystal reports, so please excuse if my question is simple.
I have to group by email_address. The query pulls data based on if (email_address like '%@abc.com' or '%@xyz.com')
I want my report to look like:

@abc.com
Record1
Record2
@xyz.com
Record1
Record2

I have created two formulas.
{Command.email_address}= '%@abc.com'
{Command.email_address}= '%@xyz.com'
How do I go from here.

Thanks,
Petronas






 
YOu need to create one formula

If {Command.email_address} like '%@abc.com' then '@abc.com'
else if {Command.email_address}like '%@xyz.com'
then
'@xyz.com'
else
'Other'

Then group on this formula.

If you do not want to see the others you can filter out in select statement using

(
{Command.email_address} like '%@abc.com' or
{Command.email_address} like '%@xyz.com'
)

Ian


 
If you are using a command, then you can insert a group on this formula:

mid({Command.email_address},instr({Command.email_address},"@"))

Note also that if you are working within the Crystal GUI, you would use "*", not "%". Within a command, however, the "%" is the appropriate wildcard.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top