For suppression of blank lines in addresses, I believe that in a recent release 
the ability to do this automatically in Memo fields was added, although I don't 
remember the details.

For myself, I use the following stored procedure in many different databases:

----------------------------------------------------------------------------
-- FormatAddress: Takes address fields and returns formatted address
---------------------------------------------------------------------------
-- PUT FormatAddress.PRC AS FormatAddress pFA_Name TEXT(30), pFA_Address1 
TEXT(30), pFA_Address2 TEXT(30), pFA_City TEXT(20), pFA_State TEXT(2), pFA_Zip 
TEXT(5), pFA_Zip4 TEXT(4) RETURN NOTE

IF pFA_Name IS NULL THEN
  RETURN NULL
ENDIF

SET VAR pFA_Result NOTE = (.pFA_Name)
IF pFA_Address1 IS NOT NULL THEN
  SET VAR pFA_Result = (.pFA_Result + CHAR(13) + CHAR(10) + .pFA_Address1)
ENDIF
IF pFA_Address2 IS NOT NULL THEN
  SET VAR pFA_Result = (.pFA_Result + CHAR(13) + CHAR(10) + .pFA_Address2)
ENDIF

IF pFA_State IS NULL THEN
  SET VAR pFA_Result = (.pFA_Result + CHAR(13) + CHAR(10) + .pFA_City & 
.pFA_Zip + IFNULL(.pFA_Zip4, (CHAR(160)), ('-' + .pFA_Zip4)))
ELSE
  SET VAR pFA_Result = (.pFA_Result + CHAR(13) + CHAR(10) + .pFA_City + ',' & 
.pFA_State & .pFA_Zip + IFNULL(.pFA_Zip4, (CHAR(160)), ('-' + .pFA_Zip4)))
ENDIF

RETURN .pFA_Result

I then create a view, or format the address directly in the variable list with 
a single CALL to FormatAddress.

In your case, since you need to show the name separately, you'll want to either 
remove pFA_Name from the list of arguments or, better, write a version of this 
function in which pFA_Name can either be passed in, or receive NULL to get left 
out of the formatted address (I think I have a version that does that at a 
client I'll be seeing today and will try to remember to send it).
--
Larry

Reply via email to