We have a report created in Crystal V10, which calls a subroutine to create an address string. The string is only created when there is an entry in the first field (ADDR1), but is blank if the address fields are only partially filled. (for example, if we only know the town, and the only field with data is ACCOUNT.TOWN).
The string creation routine looks like this:
local stringvar address;
address:="";
address:=
if ( not isnull({ACCOUNT.ADDR1})) or ( {ACCOUNT.ADDR1}<>"" ) then address:=address+{ACCOUNT.ADDR1};
if ( not isnull({ACCOUNT.ADDR2})) or ( {ACCOUNT.ADDR2}<>"" ) then address:=address+", "+{ACCOUNT.ADDR2};
if ( not isnull({ACCOUNT.ADDR3})) or ( {ACCOUNT.ADDR3}<>"" )then address:=address+", "+{ACCOUNT.ADDR3};
if ( not isnull({ACCOUNT.TOWN})) or ( {ACCOUNT.TOWN}<>"" ) then address:=address+", "+{ACCOUNT.TOWN};
if ( not isnull({ACCOUNT.COUNTY})) or ( {ACCOUNT.COUNTY}<>"" ) then address:=address+", "+{ACCOUNT.COUNTY};
if ( not isnull({ACCOUNT.POSTCODE})) or ( {ACCOUNT.POSTCODE}<>"" ) then address:=address+", "+{ACCOUNT.POSTCODE};
if ( not isnull({COUNTRY.DESCRIPTION})) or ( {COUNTRY.DESCRIPTION}<>"" ) then address:=address+", "+{COUNTRY.DESCRIPTION};
address;
If you could please let me know where the syntax is incorrect, I'd be very grateful!