Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppressing Blank Address Lines Using Formulas 2

Status
Not open for further replies.

tahir

Programmer
Oct 5, 2001
6
US
I am creating invoices and in the address sections I need to supress any line of the address that is left blank.

For example,
Address Line 1
Address Line 2
Address Line 3
Address Line 4


If only "Address Line 3" is blank in my report then I need to display the following:
Address Line 1
Address Line 2
Address Line 4


I cannot separate the sections and put a conditional surpress because there is other information on the same line further across the invoice, so I am trying to use a formula.

Here is what I tried, but anytime there is a blank line it doesn't work-----

StringVar Remitto;

Remitto := "";

IF {VW_CRYSTAL_INVOICE.REMIT_COMPANY} <> &quot;&quot; THEN
Remitto := ({VW_CRYSTAL_INVOICE.REMIT_COMPANY} + chr(13) + chr(10))
ELSE
Remitto := Remitto;
IF {VW_CRYSTAL_INVOICE.REMIT_ADDR1} <> &quot;&quot; THEN
Remitto := Remitto + ({VW_CRYSTAL_INVOICE.REMIT_ADDR1}+ chr(13) + chr(10))
ELSE
Remitto := Remitto;
IF {VW_CRYSTAL_INVOICE.REMIT_ADDR2} <> &quot;&quot; THEN
Remitto := Remitto + ({VW_CRYSTAL_INVOICE.REMIT_ADDR2}+ chr(13) + chr(10))
ELSE
Remitto := Remitto;
IF {VW_CRYSTAL_INVOICE.REMIT_ADDR3} <> &quot;&quot; THEN
Remitto := Remitto + ({VW_CRYSTAL_INVOICE.REMIT_ADDR3}+ chr(13) + chr(10))
ELSE
Remitto := Remitto;

IF {VW_CRYSTAL_INVOICE.REMIT_ADDR4} <> &quot;&quot; THEN
Remitto := Remitto + ({VW_CRYSTAL_INVOICE.REMIT_ADDR4}+ chr(13) + chr(10))
ELSE
Remitto := Remitto;


Remitto



Thanks for your help!
 
Dear Tahir;

Try this (only warning, if result is > 254 it blows up):

stringvar remitco;
stringvar addr1;
stringvar addr2;
stringvar addr3;
stringvar addr4;

remitco := if not isnull({VW_CRYSTAL_INVOICE.REMIT_COMPANY}) and {VW_CRYSTAL_INVOICE.REMIT_COMPANY} <> &quot; &quot; then {VW_CRYSTAL_INVOICE.REMIT_COMPANY} + chr(13) + chr(10)
;

addr1 := if not isnull({VW_CRYSTAL_INVOICE.REMIT_ADDR1}) and {VW_CRYSTAL_INVOICE.REMIT_ADDR1} <> &quot; &quot; then {VW_CRYSTAL_INVOICE.REMIT_ADDR1} + chr(13) + chr(10);

addr2 := if not isnull({VW_CRYSTAL_INVOICE.REMIT_ADDR2}) and {VW_CRYSTAL_INVOICE.REMIT_ADDR2} <> &quot; &quot; then {VW_CRYSTAL_INVOICE.REMIT_ADDR2} + chr(13) + chr(10);

addr3 := if not isnull({VW_CRYSTAL_INVOICE.REMIT_ADDR3}) and {VW_CRYSTAL_INVOICE.REMIT_ADDR3} <> &quot; &quot; then {VW_CRYSTAL_INVOICE.REMIT_ADDR3} + chr(13) + chr(10);

addr4 := if not isnull({VW_CRYSTAL_INVOICE.REMIT_ADDR4}) and {VW_CRYSTAL_INVOICE.REMIT_ADDR4} <> &quot; &quot; then {VW_CRYSTAL_INVOICE.REMIT_ADDR4};


remitco + addr1 + addr2 + addr3 + addr4

Place field on your report where needed and make sure to right click /format /can grow.

Hope that helps,

ro
Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
thanks a lot.


seems to have worked.

i appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top