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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display address in a letter format

Status
Not open for further replies.

mitmat

IS-IT--Management
Mar 26, 2002
24
GB
Hi,

Code below shows address in a row nicely but what I need to do is show it on separate rows and where value is Null to miss that line out?? Can it be done..

Appreciate any help






stringvar add1:=if (isnull({T_SH_ADDRESS.F_ADD_ADDR1}) OR {T_SH_ADDRESS.F_ADD_ADDR1}="") then "" else ({T_SH_ADDRESS.F_ADD_ADDR1}+", ");
stringvar add2:=if (isnull({T_SH_ADDRESS.F_ADD_ADDR2}) OR {T_SH_ADDRESS.F_ADD_ADDR2}="") then "" else ({T_SH_ADDRESS.F_ADD_ADDR2}+", ");
stringvar add3:=if (isnull({T_SH_ADDRESS.F_ADD_ADDR3}) OR {T_SH_ADDRESS.F_ADD_ADDR3}="") then "" else ({T_SH_ADDRESS.F_ADD_ADDR3}+", ");
stringvar add4:=if (isnull({T_SH_ADDRESS.F_ADD_ADDR4}) OR {T_SH_ADDRESS.F_ADD_ADDR4}="") then "" else ({T_SH_ADDRESS.F_ADD_ADDR4}+", ");
stringvar add5:=if (isnull({T_SH_ADDRESS.F_ADD_POSTCODE}) OR {T_SH_ADDRESS.F_ADD_POSTCODE}="") then "" else ({T_SH_ADDRESS.F_ADD_POSTCODE});

{T_SH_CUSTOMER.F_CUS_CUS_NAME} + ", " +ADD1 + ADD2 + ADD3 + ADD4 + ADD5;
 
hi

try this
insert char(13) this will give you a carriage return
{T_SH_CUSTOMER.F_CUS_CUS_NAME} + char(13)+
ADD1+ char(13) +
ADD2 + char(13)+
ADD3 + char(13) +
ADD4 + char(13)+
ADD5

cheers

pgtek
 
I would vouch for pgtek's approach, with a small amendment:

[PS: Where pgtek says char(13), please note that he means Chr(13)]

{T_SH_CUSTOMER.F_CUS_CUS_NAME} + chr(13)+
(If Length(ADD1) > 0 Then ADD1 + chr(13) Else "") +
(If Length(ADD2) > 0 Then ADD2 + chr(13) Else "") +
(If Length(ADD3) > 0 Then ADD3 + chr(13) Else "") +
(If Length(ADD4) > 0 Then ADD4 + chr(13) Else "") +
(If Length(ADD5) > 0 Then ADD5 + chr(13) Else "")

Naith
 
this is the proper way to do it

//@address

whilePrintingRecords;

StringVar result := {T_SH_CUSTOMER.F_CUS_CUS_NAME};

if not isnull({T_SH_ADDRESS.F_ADD_ADDR1}) OR
length(trim({T_SH_ADDRESS.F_ADD_ADDR1})) <> 0 then
result := result + chr(13) + ({T_SH_ADDRESS.F_ADD_ADDR1}+&quot;,&quot;);

if not isnull({T_SH_ADDRESS.F_ADD_ADDR2}) OR
length(trim({T_SH_ADDRESS.F_ADD_ADDR2})) <> 0 then
result := result + chr(13) + ({T_SH_ADDRESS.F_ADD_ADDR2}+&quot;,&quot;);

if not isnull({T_SH_ADDRESS.F_ADD_ADDR4}) OR
length(trim({T_SH_ADDRESS.F_ADD_ADDR4})) <> 0 then
result := result + chr(13) + ({T_SH_ADDRESS.F_ADD_ADDR4}+&quot;,&quot;);

if not isnull({T_SH_ADDRESS.F_ADD_POSTCODE}) OR
length(trim({T_SH_ADDRESS.F_ADD_POSTCODE})) <> 0 then
result := result + chr(13) + ({T_SH_ADDRESS.F_ADD_POSTCODE});

result;


It can be a little more complicated if you have something like this

City, State/Prov

since you don't necessarily add a carriage return, but you get the idea how to do it from the above

hope this helps

Jim Broadbent
 
hi

OPSSSSSSSSSSSSSS
fat fingers lol lol
should be chr(13) not char(13) :)

pgtek
 
If this works with your total report, the simplest approach is to add each address field to its own separate detail section, and then go to format section and for each detail section, check &quot;suppress blank section.&quot;

-LB
 
GEEEE!!!!!!!!

there's more than one way to skin a cat
:)

pgtek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top