Link to home
Start Free TrialLog in
Avatar of Michael Graham
Michael GrahamFlag for United States of America

asked on

Crystal Reports Suppress part of Address Field if the value is null

Hello,

I am working with Crystal Reports 11.  I am writing a formula to combine 3 address fields together.  However, one of the fields contains null values.  When it does contain a null value I want the extra space to go away.  

This is how the database looks:

Address1                     Address2               Address3
10 Main Street            Suite 5                    Boston, MA, 02118
20 Pleasant Street                                      Medford, MA, 02125

There is no Address 2 for the second line.

So my formula is this:

{Test.Address_1}+
ChrW(13)+
(If IsNull({Test.Address_2}) then
"" else {Test.Address_2})
+ChrW(13)
+ {Test.Address_3}

Result for Line 1:

10 Main Street
Suite 5
Boston, MA, 02118

Result for Line 2
20 Pleasant Street

Medford, MA, 02125

I want to remove the blank space between "20 Pleasant Street" and "Medford, MA, 02125" for the second result.

Thanks for any help,

Mike
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Graham

ASKER

Tried the first formula and it was perfect.  Awesome.  Thank you so much.