Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Create an address label
Tue, Aug 7 2007 3:38 PMPermanent Link

Ezra Marshall
Wish to create a label for an address using name, address1, address2, address3, city, zip,
country.
I want each address line to fall on a different line without blank lines
e.g. name='Ezra Marshall', address1= '#7 E49 St', address2= 'Brooklyn', address3= '',
city= 'New York', zip = '11234', country= 'USA' to
print as

Ezra Marshall
#7 E49 St
Brooklyn
New York 11234
USA
Wed, Aug 8 2007 3:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ezra


You need to use IFs. Think how you would write it in straight code and then translate to sql. I'm not going to try and write it all because it will be horrible and I'll miss the odd bracket or comma but to give you an idea

IF(address1 IS NOT NULL,address1,'') +
IF(address2 IS NOT NULL AND address1 IS NOT NULL,#13#10,'') +
IF(address2 IS NOT NULL,address2,'') +
IF(address3 IS NOT NULL AND (address2 IS NOT NULL OR address1 IS NOT NULL),#13#10,'') +
IF(address3 IS NOT NULL,address3,'') +

etc etc

Roy Lambert
Wed, Aug 8 2007 5:05 AMPermanent Link

"Malcolm"
If the query is being fed to a report writer you may find it has a
setting to ignore null values in a case like this.

Using Fast Report 3 I don't have to worry about null address label
lines.  Surprised
Image