I do it from a SP..

It's a little leggy, but it gives me what I want.  Customers/Contacts can have 
different types of addresses (RemitTo, ShipTo, HomeOffice, etc) so pt1 is the 
address type passed in.

The Structure of the SP

Parameter Name       Parameter Attributes
  -------------------- ---------------------------------------------------------
  pt1                  Type       : TEXT 8

  Procedure has 1 parameters.
  Return Value:        Type       : TEXT 128



<begin code>

CLEAR VAR MICRORIM_RETURN, stp_return, vret, vrettext
SET VAR pt1 TEXT -- ='miby'
SET VAR pi1 INTEGER -- =1
IF pt1 IS NULL OR pi1 IS NULL THEN
  SET VAR vrettext = 'Null Var Passed'
  RETURN .vRettext
ENDIF
SET VAR vcr = ((CHAR(13)) + (CHAR(10)))
SELECT mainname,address1,address2,city,statename,zipcode,zipplus +
INTO vmainname IND vin0, vaddress1 IND vin0, vaddress2 IND vin0, +
vcity IND vin0, vstatename IND vin0,vzipcode IND vin0, vzipplus IND vin0 +
FROM vwcontacts WHERE (addrcode = .pi1 AND cid = .pt1)

IF SQLCODE = 0 THEN
  SET VAR vrettext = .vmainname
  IF vaddress1 <> NULL THEN
    SET VAR vrettext = (.vrettext + .vcr + .vaddress1)
  ENDIF
  IF vaddress2 <> NULL THEN
    SET VAR vrettext = (.vrettext + .vcr + .vaddress2)
  ENDIF
  IF vcity <> NULL THEN
    SET VAR vrettext = (.vrettext + .vcr + .vcity)
  ENDIF
  IF vstatename <> NULL THEN
    SET VAR vrettext = (.vrettext + ' ' + .vstatename)
  ENDIF
  IF vzipcode <> NULL THEN
    SET VAR vrettext = (.vrettext + ' ' + .vzipcode)
  ENDIF
  IF vzipplus <> NULL THEN
    SET VAR vrettext = (.vrettext + '-' + .vzipplus)
  ENDIF
ELSE
  SET VAR vrettext = 'No Address Entry'
ENDIF

CLEAR VAR pt1,vin0,vcity,vstatename,vaddress1, +
vaddress2,vmainname,vzipcode,vzipplus
RETURN .vrettext
<end code>




----- Original Message ----- 
From: "Dennis McGrath" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, October 08, 2008 3:13 PM
Subject: [RBASE-L] - Address formatting question


I seem to remember something in a demo of a slick way to format a mailing 
address.

Say the address has 6 lines.  Any of the lines can be null.

I'm doing some fiddling in code and variables to move lines up the pecking 
order so the address always formats without blank lines.

Does anyone have an even better way to do this on an RBASE report?

If not, don't worry, my old stuff will work fine, but I'm always looking for 
more efficient ways to do things.

Thanks
Dennis McGrath


Reply via email to